类似的还有Qs的上SO,但我能找到没有关于我的具体ASP.NET MVC 5和Visual Studio 2015RC CS0234和CS0103错误
的ASP.NET MVC文件的新项目建造和运行正常,但在编辑器我有许多CS0234: “类型或命名空间'MVC'不存在'和CS0103:名称xxxx在当前上下文中不存在的红色字形。其中xxxx是ViewBag,脚本,RenderSection等
在使用@Model添加模型和在该模型上引用项目时,这在编辑器中也会失败。在2015年开放vs2013的现有项目也表现相同。我可以在本地bin目录中看到System.Web.Helpers.dll和System.Web.Mvc.dll的本地副本,但编辑器无法引用这些副本。
我试过删除并重新安装MVC(Microsoft.AspNet.Mvc)手动使用nuget无济于事。
os:windows 8.1 pro
也许一个已知的bug?希望有人能够对此提出一些看法。
Web配置(摘录):
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
包(摘录):
<packages>
<package id="Microsoft.AspNet.Identity.Core" version="2.2.0" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.0" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.0" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" userInstalled="true" />
</packages>
以为我已经解决了这个问题(见下文人造修复低于1),但C#代码完成/智能感知是仍然破裂。重新安装VS没有任何区别。
人造修复1个 squigglies + CS0234错误消失了,但没有C#智能感知/代码完成
- 去程序和功能来修改当前VS设置
- 几乎立即删除只是网络工具中止上述 - 安装程序中止没有更改,除可能设置还原点。认为回到VS并首先卸载Web Essentials扩展是明智的做法!
- 在VS卸载网络要领
- 上重新启动VS了,我卸载
- 开业VS再次检查仍然工作(以下错误详细信息)与放肆扩展的错误 - newed了一个asp.net mvc的5项目(所以在这个阶段没有对已安装的组件进行更改),并且编辑器中的所有错误消失了!
- 重装以上扩展,一切仍然有效
错误的详细信息(从%APPDATA%\微软\ VisualStudio的\ 10.0 \ ActivityLog。XML)人造修复
<entry>
<record>389</record>
<time>2015/05/06 19:45:05.396</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Begin package load [ChutzpahVS2012Package]</description>
<guid>{A523D775-1341-4F21-A950-8C716E5628C9}</guid>
</entry>
<entry>
<record>390</record>
<time>2015/05/06 19:45:05.396</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [ChutzpahVS2012Package]</description>
<guid>{A523D775-1341-4F21-A950-8C716E5628C9}</guid>
<hr>80070002</hr>
<errorinfo>Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.</errorinfo>
</entry>
末1
我不清楚 - 当你创建一个新的MVC5项目吗? –
@Simon McKenzie - yes file new project – Andrew
[This article on MVC4](http://colinmackay.scot/tag/asp-net-mvc-4/)建议将'System.Web.Mvc'引用设置为“Copy本地”。这有帮助吗? –