开发者

MvcContrib Portable Areas View Intellisense?

开发者 https://www.devze.com 2022-12-30 13:39 出处:网络
I\'ve started using Portable Areas from the MvcContrib project. Everything works great with the exception of Visual Studio Intellisense. Has anyone been able to get their View intellisense to work...

I've started using Portable Areas from the MvcContrib project. Everything works great with the exception of Visual Studio Intellisense. Has anyone been able to get their View intellisense to work...

开发者_高级运维

Html. <-- does not exist in the current context.

I'm also not able to get intellisense on any of the models created in the same project...


I have the following web.config under the View folder for each portable area and intellisense is working for me. This is using asp.net 4.0, but I am pretty sure you can use the same format under 3.5.

Hope this helps

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral,    PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
</compilation>
<pages validateRequest="false"
    pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
  </namespaces>
</pages>
  </system.web>
</configuration>


Yes. You need the pages declaration from the web.config in the normal views/shared folder in the folder you have your portable area view:

<pages
    validateRequest="false"
    pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter"
    pageBaseType="System.Web.Mvc.ViewPage"
    userControlBaseType="System.Web.Mvc.ViewUserControl">
  <controls>
    <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
  </controls>
</pages>


I got this Web.Config from the PrecompiledMvcViewEngine NuGet Package and it works like a charm!

Place it in the root folder of your project!!

<?xml version="1.0"?>    
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
  </system.web>
</configuration>
0

精彩评论

暂无评论...
验证码 换一张
取 消