Monday, March 23, 2015
In this blog we will go over how to upgrade your existing project which uses ASP.NET MVC 4 to ASP.NET MVC 5 using NuGet. During the upgrade you will encounter some errors but they are easy enough to fix by changing the Web.Config file. In the first blog we will create a simple ASP.NET MVC 4 application from scratch.
But first thing is first let's begin by creating a project in ASP.NET MVC 4:
2. Now add a new project to the "MVCProjects" by selecting ASP.NET MVC4, call it "MyMVC4".
But first thing is first let's begin by creating a project in ASP.NET MVC 4:
2. Now add a new project to the "MVCProjects" by selecting ASP.NET MVC4, call it "MyMVC4".
Make sure you select Visual C# → Web → Visual Studio 2012 → ASP.NET MVC 4 Web Application, then click "OK"
3. Select the "Empty" template, and "Razor" as the "View Engine", then click "OK"
4. Right click on the "Controller" and select "Add" → "Controller"
5. On the "Add Controller" screen type "HomeController" on the "Controller name" text box and select "Empty MVC controller". We just want to keep things simple for this blog. Then click "Add"
6. You see the "HomeController.cs" class being added to the "Controllers" folder
8. Right click on the "Index()" method and select "Add View"
9. Uncheck the "Use a layout or master page" checkbox. Accept the default settings, MVC uses conventions so the view has the same name as the method name in the "HomeController.cs" file which is "Index()", then click "Add"
10. In the "Views" folder you see that the "Home" folder has been created with the view "Index.cshtml", the .cshtml extension means that the view uses the C# syntax.
11. Double click on the view "Index.cshtml" and type "Hello World" between the <div> tag like the markup below
12. Press Ctrl+F5 to run the application, you will see the following.
In this blog we went over how to create a simple ASP.NET MVC 4 application. In the next part we will go through the steps on how to upgrade your ASP.NET MVC 4 application to ASP.NET MVC 5 using NuGet
3. Select the "Empty" template, and "Razor" as the "View Engine", then click "OK"
4. Right click on the "Controller" and select "Add" → "Controller"
5. On the "Add Controller" screen type "HomeController" on the "Controller name" text box and select "Empty MVC controller". We just want to keep things simple for this blog. Then click "Add"
6. You see the "HomeController.cs" class being added to the "Controllers" folder
7. Double click on the "HomeController.cs" file and you will see the following code
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MyMVC4.Controllers { public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { return View(); } } }
8. Right click on the "Index()" method and select "Add View"
9. Uncheck the "Use a layout or master page" checkbox. Accept the default settings, MVC uses conventions so the view has the same name as the method name in the "HomeController.cs" file which is "Index()", then click "Add"
10. In the "Views" folder you see that the "Home" folder has been created with the view "Index.cshtml", the .cshtml extension means that the view uses the C# syntax.
11. Double click on the view "Index.cshtml" and type "Hello World" between the <div> tag like the markup below
@{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> </head> <body> <div> Hello World! </div> </body> </html>
12. Press Ctrl+F5 to run the application, you will see the following.
In this blog we went over how to create a simple ASP.NET MVC 4 application. In the next part we will go through the steps on how to upgrade your ASP.NET MVC 4 application to ASP.NET MVC 5 using NuGet
Subscribe to:
Post Comments (Atom)
Search This Blog
Tags
Web Development
Linux
Javascript
DATA
CentOS
ASPNET
SQL Server
Cloud Computing
ASP.NET Core
ASP.NET MVC
SQL
Virtualization
AWS
Database
ADO.NET
AngularJS
C#
CSS
EC2
Iaas
System Administrator
Azure
Computer Programming
JQuery
Coding
ASP.NET MVC 5
Entity Framework Core
Web Design
Infrastructure
Networking
Visual Studio
Errors
T-SQL
Ubuntu
Stored Procedures
ACME Bank
Bootstrap
Computer Networking
Entity Framework
Load Balancer
MongoDB
NoSQL
Node.js
Oracle
VirtualBox
Container
Docker
Fedora
Java
Source Control
git
ExpressJS
MySQL
NuGet
Blogger
Blogging
Bower.js
Data Science
JSON
JavaEE
Web Api
DBMS
DevOps
HTML5
MVC
SPA
Storage
github
AJAX
Big Data
Design Pattern
Eclipse IDE
Elastic IP
GIMP
Graphics Design
Heroku
Linux Mint
Postman
R
SSL
Security
Visual Studio Code
ASP.NET MVC 4
CLI
Linux Commands
Powershell
Python
Server
Software Development
Subnets
Telerik
VPC
Windows Server 2016
angular-seed
font-awesome
log4net
servlets
tomcat
AWS CloudWatch
Active Directory
Angular
Blockchain
Collections
Compatibility
Cryptocurrency
DIgital Life
DNS
Downloads
Google Blogger
Google Chrome
Google Fonts
Hadoop
IAM
KnockoutJS
LINQ
Linux Performance
Logging
Mobile-First
Open Source
Prototype
R Programming
Responsive
Route 53
S3
SELinux
Software
Unix
View
Web Forms
WildFly
XML
cshtml
githu
No comments:
Post a Comment