简体   繁体   中英

Problems after migrating VS2013 to VS2015 in MVC

UPDATED QUESTION

I have a project that I've started in VS 2013 and was setup as the following:

MyMainMvcApp (Containing core Functionality)
MyPlugin (Containing plugable customer stuff)

MyPlugin contains some *.cshtml views as embedded resource and some controllers.

In VS2013 I was able open the Views and i had full Razor Intellisense and no issues when compiling.

IN V2015 the Error List is showing a lot of errors like

Feature 'lambda expression' is not available in C# 2.  Please use language version 3 or greater.
The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

etc etc

Of course I have all the Assemblies referenced. And the projects even compile.

I believe that VS 2015 is just missing some config stuff in web.config or similar, so that he can resolve the stuff while having the view open in designer.

I have an app.config in MyPlugin project that has been added from Nuget. I've put the same config stuff as my web.config in there but that didn't help.

As well I copied the MyMainMvcApp\\Views\\web.config into MyPlugin\\Views\\web.config that didn't work as well.

Any idea what the issue might be or ideas how to solve it?

I've started MyPlugin as a Class Library in VS 2013 and that worked well. Afterwards I was not able to make MyPlugin work as desired in VS 2015 designer. I've created a new MyPlugin Project as a MVC Project and copied all my code from the old library to the new.

It's a workaround but that solves my VS 2015 problems.

The fact that it's trying to utilize C# 2, is pretty concerning. Make sure your project is targeting the latest version of .NET you feel comfortable with. Since you're using VS2015, go all the way to 4.6 if you like, or if you want something a little more hardened, stick with 4.5.2. Just right-click your project in the Solution Explorer and choose "Properties". Then on the first "Application" tab, change the "Target framework" drop-down to something appropriate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM