Visual Studio 2015 does not recognize imported namespaces in web.config for Razor
I have a website project containing numerous .cshtml files (WebPages, not MVC) and where I have defined a common set of namespaces in my web.config file like this
<system.web.webPages.razor>
<pages pageBaseType="Composite.AspNet.Razor.RazorFunction">
<namespaces>
<add namespace="DinArv.Forms"/>
<add namespace="DinArv.Web"/>
</namespaces>
</pages>
</system.web.webPages.razor>
After installing VS 2015 RTM, I suddenly get "Type or space errors ... cannot be found" for the types that exist in the namespaces defined in the web.config, while Resharper doesn't seem to have a problem, I also can view the pages well and not generate build errors when building my website. In my Visual Studio 2013, Intellisense works as it should.
If I import the namespaces explicitly in the .cshtml file instead of the web.config, VS 2015 will be fine too, but I really don't want to.
What is wrong and how can I fix it?
source to share
After hours and hours, I accidentally stumbled upon what seemed to do the trick. My section group was defined like this: VS 2013 had no problem with
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
</sectionGroup>
As soon as I added the version number to types like this, Intellisense in VS 2015 caught fire. Grrrrr .... what a waste of time but hopefully it could save someone else time.
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
source to share