I have just moved a 7.2.5 project from VS 2012 to VS 2015 but am getting the following Intellisense errors. I have upgraded MVC to 4.0.0.1 and added in a binding redirect. This produces a warning under references to Umbraco, var, String - pretty much everything.
Severity Code Description Project File Line
Warning CS1702 Assuming assembly reference 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' used by 'umbraco' matches identity 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' of 'System.Web.Mvc', you may need to supply runtime policy rbl2015
It took me a while to realize and, to be honest, I ignored the upgrade report when opening Umbraco projects in VS15. They clearly state:
ASP.NET MVC 4 projects have limited functionality in Visual Studio
Next. Commands such as Add Controller, Add View, Add Area, and Go to
View/Controller are not available. Intellisense for Razor (CSHTML and
VBHTML) files is limited to HTML markup.
However, there is a bug in Umbraco currently, if you have a macro that contains a SurfaceController and in the SurfaceController you do ModelState.AddModelError("SomeField", "Some message"); then it will fail. This is fixed in 7.3.0.
I'm about to write a blog post on how to upgrade an Umbraco project to MVC5. If you use NuGet then it should be as "easy" as:
You might also need to install WebHelpers if you currently have it installed:
Install-Package Microsoft.AspNet.WebHelpers
Which then most likely also requires:
Install-Package Microsoft.AspNet.WebPages.Data
Lastly, you will need to go to Views\web.config and replace all instances of 2.0.0.0 with 3.0.0.0 and all instances of 4.0.0.0 with 5.2.3.0.
Yeah "easy", right? ;-)
It's a bit shitty but Microsoft in their infinite wisdom decided that they don't support MVC4 any more in VS15 so either use VS13 or upgrade to MVC5 if you want the squiggles to go away (intellisense still works but everything is marked as being "wrong").
ASP.NET MVC 4 projects have limited functionality in Visual Studio Next. Commands such as Add Controller, Add View, Add Area, and Go to View/Controller are not available. Intellisense for Razor (CSHTML and VBHTML) files is limited to HTML markup.
@Seb, thanks for putting this all together. FWIW though it's not working for me. Still getting red squigglies but it's likely something I didn't do properly.
1- If the following lines of code give a warning:
Assuming assembly reference 'system.web.mvc version = 5.2.3.0 culture = neutral, publickeytoken = version = 5.2.4.0
Requirements:
If the Microsoft.AspNet.Mvc package is version 5.2.4 or higher
Remove the installed package from the Nuget Package Manager by selecting the dependency options,
Then, installing Install.Package Microsoft.AspNet.Mvc -Version 5.2.3 will eliminate the problem.
2- After doing this step, you will need to Clean Solution and then Build it.
3- In the build process, it can give an error message as follows.
Intellisense in VS 2015
I have just moved a 7.2.5 project from VS 2012 to VS 2015 but am getting the following Intellisense errors. I have upgraded MVC to 4.0.0.1 and added in a binding redirect. This produces a warning under references to Umbraco, var, String - pretty much everything.
Severity Code Description Project File Line Warning CS1702 Assuming assembly reference 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' used by 'umbraco' matches identity 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' of 'System.Web.Mvc', you may need to supply runtime policy rbl2015
It took me a while to realize and, to be honest, I ignored the upgrade report when opening Umbraco projects in VS15. They clearly state:
However, there is a bug in Umbraco currently, if you have a macro that contains a SurfaceController and in the SurfaceController you do
ModelState.AddModelError("SomeField", "Some message");
then it will fail. This is fixed in 7.3.0.I'm about to write a blog post on how to upgrade an Umbraco project to MVC5. If you use NuGet then it should be as "easy" as:
these may fail if you don't have these packages installed, so ignore errors from that
don't forget the
-Force
You might also need to install WebHelpers if you currently have it installed:
Which then most likely also requires:
Lastly, you will need to go to
Views\web.config
and replace all instances of2.0.0.0
with3.0.0.0
and all instances of4.0.0.0
with5.2.3.0
.Yeah "easy", right? ;-)
It's a bit shitty but Microsoft in their infinite wisdom decided that they don't support MVC4 any more in VS15 so either use VS13 or upgrade to MVC5 if you want the squiggles to go away (intellisense still works but everything is marked as being "wrong").
Thanks Sebastiaan, that works! No more squiggles!
Is it not possible to add MVC4 support?
I have a bunch of old projects, that I don't really want to upgrade to MVC5.
@Søren It's simply not supported by MS:
Comment author was deleted
Related topic here: https://our.umbraco.org/forum/developers/razor/66923-viewswebconfig-namespaces-not-available-in-views-in-visual-studio-2015-text-editor#comment-232554
Posting for convenience.
Comment author was deleted
@Seb, thanks for putting this all together. FWIW though it's not working for me. Still getting red squigglies but it's likely something I didn't do properly.
I'll try again another time :)
After installation of Umraco with MVC selection
1- If the following lines of code give a warning: Assuming assembly reference 'system.web.mvc version = 5.2.3.0 culture = neutral, publickeytoken = version = 5.2.4.0
Requirements:
If the Microsoft.AspNet.Mvc package is version 5.2.4 or higher Remove the installed package from the Nuget Package Manager by selecting the dependency options, Then, installing Install.Package Microsoft.AspNet.Mvc -Version 5.2.3 will eliminate the problem.
2- After doing this step, you will need to Clean Solution and then Build it. 3- In the build process, it can give an error message as follows.
Analyzer 'Microsoft.CodeAnalysis.CSharp.Analyzers.FixAnalyzers.CSharpFixerWithFixAllAnalyzer' threw an exception of type Solution from Console From the following URL https://www.nuget.org/packages/microsoft.codeanalysis.analyzers
Microsoft.CodeAnalysis.Analyzers 2.6.3 The Nuget Package will be installed to correct the corresponding error.
Then you will need to Clean the project and then Clean again.
That's all
is working on a reply...