Upgrade MVC1 project to MVC5 - asp.net-mvc

Is there a way to convert a ASP.Net MVC 1 project build in VS2008 to ASP.Net MVC 5 and VS2015?
I tried to just open it in VS 2015 but that gave the error "This project is incompatible with the current version of Visual Studio".

There are ways to reference newer versions and update, eg:
http://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
.. however updating from MVC1 (especially if you cannot open the project) you probably don't want to manually install ASP.NET MVC installs etc (if that what I remember)
I would suggest creating a new MVC5 application, referencing MVC via Nuget etc and pulling in code as required. This will give you a chance to re-structure things and learn newer ways otherwise you my be fighting with MVC configuration and references.

Related

How to migrate VS2010 MVC3 project to VS2015?

When I try to open an existing solution (to ultimately convert it to later MVC and .NET packages), VS2015 rejects the project:
The application which this project type is based on was not found. Please try this link for further information: http://go.microsoft.com/fwlink/?LinkID=299083&projecttype=E53F8FEA-EAE0-44A6-8774-FFD645390401
That link is worthless as it takes me to a VS2013 compatibility page.
My goal is to migrate the project from MVC3/.NET4.0 to MVC5/.NET4.5.
I can't target a later MVC or .NET in VS2010. VS2015 won't open the older project so the solution here won't work Some (official or not) upgrade Mvc3 to Mvc5 guide?? for changing the properties of the project since the project won't open.
Mvc3 is not supported after VS2010.Iuse VS2010SP1.
You may make it work but it will bite you in the end.
You have to choose the VS version and the corresponding Mvc version
I went into the csproj file manually and switched the ProjectTypeGuid to that of an MVC4 project: E3E379DF-F4C6-4180-9B81-6769533ABE47. Then VS2015 was able to open the project and it upgraded it to MVC5 guid correctly.

VS2015 ASP.NET MVC the name 'model' does not exist in the current context

I was working on an ASP.NET MVC 4 in VS2013 and everything was fine, then I've uninstalled 2013 and installed 2015, I was able to open the project, build it and even run, everything works fine (run/debug). The problem is that all my views are covered in errors:
the name 'model\Scripts\Url...' does not exist in the current context
In addition, the .Where method of a list in the model shows an error as well as all the #Html helpers. I want to emphasize that the project still works w\o any problems so the issue is UI or package related. I tried to force uninstall\upgrade Microsoft.AspNet.MVC but the package manager console throws an error and rolls back the attempt. I can provide any necessary info if it helps, thank you in advance.
The newly released VS2015 IDE seems to no longer support MVC3/MVC4 projects, while it only supports the MVC5:
Unable to find MVC3 , MVC4, MVC5 projects (or) No information about supported MVC Framework versions
If there are strict requirements to convert any existing MVC3/4 solution to MVC5 (for VS 2015), you can proceed with the steps listed in the
How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2 guide.
Update 2016-05-03
It seems that after installing the VS 2015 SP2 update, it behaves much better. If you have a chance, I suggest that you upgrade your IDE and check if the issue goes away.

How to upgrade mvc2 to mvc5?

I've got an old project from a friend that he wants me to do redo. How ever that project is written in ASP.net mvc2. So When I try to open it in visual studio 2013 I can errors. Saying the file is incompatible. How would I go ahead and fix this?
I would highly recommend you to create a new empty MVC 5 project, and move all your files there from old MVC 2 project. If you just try to update DLLs its very hard be sure if you updated all DLLs, proj file, nugets, or at least little bit more work by copying files is well worth it. Problem is that VS2013 is not compatible with old version of MVC framework.
But, if you really want to open MVC 2 solution in VS2013, you can try following some steps described here: How do I open an old MVC project in Visual Studio 2012 or Visual Studio 2013? (contains a project Guid that needs to be changed inside .proj file)

Can I open dot Net MVC project in VS 2013?

We have a very old legacy system which was developed using MVC1 through Visual Studio. Since then , Visual Studio also evolved and so has MVC.
Now we want to make our MVC1 project compliant with MVC5. Is there any, ready made tool available for this?
Various forums suggest to gradually move the project from MVC1 to MVC2, then from MVC2 to MVC3 and so on.
But I was not able to find any way of converting from MVC1 to MVC2. Although the information regarding the same is still available, but the tool to convert MVC1 to MVC2 is not found.
Can any one please throw some light on this?
You can use the old version of ASP.NET Project upgrade tool as the limitation is
The tool does not support Visual Studio 2008 solutions, MVC 1 projects, or projects targeting .NET 3.5. If you have a MVC 1.0 project you can use the old version of this tool to convert it to MVC 2.
You can also manually upgrade to MVC 3
The white paper steps for upgrading MVC1.0 to MVC2.0 are
Fiddle with web.csproj
Replace Version=1.0.0.0 in web.config by Version=2.0.0.0
Reference System.Web.Mvc (v2.0.0.0) in the project
chnange bindingRedirect in web.config
update css and js files

After installing MVC3, I can't create or open projects for MVC2 on visual studio 2010

Opening MVC2 Projects just makes "project not supported" error on visual studio, and i can't find the template for creating new projects for mvc2.
I undertand that the mvc2 new project template could be not desired after installing mvc3, but the support for editing and maitaining mvc2 projects should still be there.
in the release notes it states:
ASP.NET MVC 3 can be installed side by
side with ASP.NET MVC 2 on the same
computer, which gives you flexibility
in choosing when to upgrade an ASP.NET
MVC 2 application to ASP.NET MVC 3
I know I have mvc1, mvc2 and mvc3 dlls "side by side" on my GAC, but i'm still hoping this visual studio error is a error in my setup.
If not, ¿Is possible to upgrade the project file and keep all contents the same, pointing to the mvc2 dll?
To answer my own question after a few attempts:
Yes, it is possible to upgrade the project without altering MVC2. Just apply step 8 of the manual migration procedure on the release notes for MVC3:
8- Locate the ProjectTypeGuids element and replace
{F85E285D-A4E0-4152-9332-AB1D724D3325}
with
{E53F8FEA-EAE0-44A6-8774-FFD645390401}.
and reload the project.
This should be all.
The downside is that if other people are working on this project, they will now need to install MVC3 too, in order to get Visual Studio to recognize this new project GUID.

Resources