Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mitton 22 posts 71 karma points c-trib
    Jun 27, 2015 @ 07:40
    Mitton
    0

    Views\Web.config namespaces not available in views in Visual Studio 2015 text editor

    I'm using Visual Studio 2015 RC (I know...)

    The namespaces specified in my Views\Web.config file are not coming into Intellisense.

    In web.config, I have the following:

      <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.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Routing" />
            <add namespace="Umbraco.Web" />
            <add namespace="Umbraco.Core" />
            <add namespace="Umbraco.Core.Models" />
            <add namespace="Umbraco.Web.Mvc" />
            <add namespace="umbraco" />
            <add namespace="Examine" />
          </namespaces>
        </pages>
      </system.web.webPages.razor>
    

    But in the text editor, I'm unable to use the Html extension methods those namespaces provide.

    For example

    @{Html.Action("GetCompanies", "CompaniesSurface");}
    

    gives me red squiglies under Action, unless I manually include the namespace like this right in the view file:

    @using System.Web.Mvc.Html
    

    I'm also unable to use the @model syntax, so for my strongly typed partial views, instead of using:

    @model ModelClass
    

    I have to use:

    @inherits System.Web.Mvc.WebViewPage<LumaEE.Models.Company>
    

    This happened both with a project I created in VS 2013 and then opened in VS 2015 RC, and with a project I created from scratch in VS 2015 RC.

    I'm guessing it's a Visual Studio issue. Has anyone else seen this? What can I try to fix it?

  • Rasmus Eeg 91 posts 452 karma points c-trib
    Jun 27, 2015 @ 08:16
    Rasmus Eeg
    0

    Hi Mitton,

    I suggest you take a look at this post.

    http://umbraco.com/follow-us/blog-archive/2015/2/19/umbraco-722-and-625-released

    The reason is that VS2015 only supports MVC5 at the moment. Either upgrade umbraco to mvc5 or use VS2013 for intellisence.

    Upgrading umbraco to MVC 5 causes issues for some people so its not recommended.

    Best regards. R.

  • Peter Gregory 404 posts 1568 karma points MVP 3x admin c-trib
    Jul 23, 2015 @ 01:51
    Peter Gregory
    0

    This issue still happens with the RTM as well. Upgrading to MVC5 is not really a good solution when it is not an option due to the age of the solution.

    For now I have moved back to vs2013 as I just cant see past the red squiggles.

  • Comment author was deleted

    Oct 26, 2015 @ 14:05

    Bump. Red squiggle hell here with VS2015, anyone get past it yet?

  • Comment author was deleted

    Oct 26, 2015 @ 14:08
  • gary 385 posts 915 karma points
    Oct 26, 2015 @ 16:12
    gary
    0

    Hi Kevin

    Not seeing it now.

    Create doctype and template in Umbraco, then go to VS and right click the view file and include in project. Wait maybe 10 seconds and you will see the change.

    Regards

    Gary

  • Biagio Paruolo 1492 posts 1632 karma points c-trib
    Dec 10, 2015 @ 23:04
    Biagio Paruolo
    0

    Don't work this workaround...I tried with a project with U7.3.3 ported from vs2013 to 2015

Please Sign in or register to post replies

Write your reply to:

Draft