简体   繁体   English

在MVC中将VS2013迁移到VS2015后出现问题

[英]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: 我有一个项目,我已经在VS 2013中开始,并设置如下:

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

MyPlugin contains some *.cshtml views as embedded resource and some controllers. MyPlugin包含一些* .cshtml视图作为嵌入式资源和一些控制器。

In VS2013 I was able open the Views and i had full Razor Intellisense and no issues when compiling. 在VS2013中,我可以打开视图,我有完整的Razor Intellisense,编译时没有问题。

IN V2015 the Error List is showing a lot of errors like 在V2015中,错误列表显示了很多错误,例如

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. 当然,我引用了所有的Assemblies。 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. 我相信VS 2015只是缺少web.config或类似的一些配置内容,因此他可以在设计器中打开视图时解决这些问题。

I have an app.config in MyPlugin project that has been added from Nuget. 我在MyPlugin项目中有一个已从Nuget添加的app.config。 I've put the same config stuff as my web.config in there but that didn't help. 我在那里放了与我的web.config相同的配置内容,但这没有帮助。

As well I copied the MyMainMvcApp\\Views\\web.config into MyPlugin\\Views\\web.config that didn't work as well. 我还将MyMainMvcApp \\ Views \\ web.config复制到MyPlugin \\ Views \\ web.config中,但也无法正常工作。

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. 我已经在VS 2013中将MyPlugin作为类库启动并且运行良好。 Afterwards I was not able to make MyPlugin work as desired in VS 2015 designer. 之后我无法在VS 2015设计师中按照需要使MyPlugin工作。 I've created a new MyPlugin Project as a MVC Project and copied all my code from the old library to the new. 我已经创建了一个新的MyPlugin项目作为MVC项目,并将我的所有代码从旧库复制到新库。

It's a workaround but that solves my VS 2015 problems. 这是一种解决方法,但它解决了我的VS 2015问题。

The fact that it's trying to utilize C# 2, is pretty concerning. 它试图利用C#2的事实非常令人担忧。 Make sure your project is targeting the latest version of .NET you feel comfortable with. 确保您的项目针对您认为最适合的.NET版本。 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. 既然您正在使用VS2015,如果您愿意,可以一直使用4.6,或者如果您想要更强硬的东西,请坚持使用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. 然后在第一个“应用程序”选项卡上,将“目标框架”下拉列表更改为适当的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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