简体   繁体   中英

I am not getting Intellisense in VS2013

I am not able to get Intellisense support for Visual Studio Premium 2013 in razor view. This is happening for a specific project. I am able to get the intelligence support for a new project. I have tried to compare the web.config file for both the projects. Still not able to resolve.

I feel the below namespaces are responsible for getting intelligence support in views:

Web.config:

<system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <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" />
      </namespaces>
    </pages>
</system.web.webPages.razor>

i am getting a red underline for my model object as it is not recognizing my model object

@model MyProject.Customers

please follow the below mentioned steps to solve your problem.

step 1: Please add your model namespace in /views/Web.config file like the following.

 <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>           
        <add namespace="*******your model namespace goes here******" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

step 2: unload your project
step 3: reload your project

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