打开一个MVC3项目在VS2012 [英] Opening an MVC3 project in VS2012
问题描述
我试图打开新安装的Visual Studio防爆preSS 2012 RC的MVC3的解决方案。到目前为止,我有问题,由于某种原因VS2012不知道该项目是MVC项目,所以它不会添加视图/控制器。有过去,这通过添加下面GUID解决方案中的每个项目的 .csproj的
文件中的 ProjectTypeGuids
节点:
I am trying to open an MVC3 solution in a newly installed Visual Studio Express 2012 RC. So far, I've had issues that for some reason VS2012 doesn't know that the projects are MVC projects, so it won't add Views/Controllers. Got past this by adding the following GUID to the ProjectTypeGuids
node of the .csproj
file of each project in the solution:
{E53F8FEA-EAE0-44A6-8774-FFD645390401}
然而,当我打开剃须刀的观点,它显示了这些错误(其他相关的人之间):
Error 20 The name 'model' does not exist in the current context c:\Users\willem\Documents\Visual Studio 2010\Projects\000-Orchard Development\src\Orchard.Web\Modules\EventManagement\Views\EditorTemplates\Parts\Event.cshtml 2 2 EventManagement
Error 21 The name 'T' does not exist in the current context c:\Users\willem\Documents\Visual Studio 2010\Projects\000-Orchard Development\src\Orchard.Web\Modules\EventManagement\Views\EditorTemplates\Parts\Event.cshtml 5 14 EventManagement
Error 22 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'LabelFor' and no extension method 'LabelFor' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?) c:\Users\willem\Documents\Visual Studio 2010\Projects\000-Orchard Development\src\Orchard.Web\Modules\EventManagement\Views\EditorTemplates\Parts\Event.cshtml 6 11 EventManagement
智能感知是工作在剃刀视图,但只给出了HTML辅助方法领域的限制。例如,没有像LabelFor和TextboxFor模型的具体方法。
Intellisense is working in the razor view, but it only gives limited amount of fields for the Html helper method. For instance, none of the model specific methods like LabelFor and TextboxFor.
我有MVC 3和4安装。该解决方案在VS2010工作得很好。
I have MVC 3 and 4 installed. The solution worked fine in VS2010.
更新:
在添加新 MVC3在VS2012的项目,它工作正常。因此,这意味着它肯定是与该项目,而不是安装。
When adding a new MVC3 project in VS2012, it works fine. So that means it is definately something to do with the project, and not the installation.
更新2:
我认为问题是,视图没有访问引用的库根的配置:
UPDATE 2: I think that the issue is that the view doesn't have access to the referenced libraries in the root config:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/>
<add namespace="Orchard.Mvc.Html"/>
</namespaces>
</pages>
</system.web.webPages.razor>
它确实在运行,但intellilsense和错误控制台不捡起来。
It does at runtime, but the intellilsense and error console doesn't pick it up
任何帮助是AP preciated。
Any help is appreciated.
感谢
推荐答案
我通过卸载MVC4 RC解决了这个问题。似乎并没有与我的系统(或者我测试的3等系统)兼容。就只能等待MVC4的发行版
I fixed this by uninstalling MVC4 RC. Doesn't seem compatible with my system (or the 3 other systems I tested with). Will just have to wait for the release version of MVC4
这篇关于打开一个MVC3项目在VS2012的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!