Resharper no longer analyzing razor/CSHTML files

Using latest Resharper - 2020.2.4 - it has stopped analyzing my Razor/CSHTML files inside my ASP.NET MVC Framework project. It used to work fine, and I cannot figure out what could've changed.

 

If I make a new solution/project, it seems to be working (showing the green checkmark above the scrollbar). But our main solution file for our website no longer shows this for its Razor files.

I've tried resetting Visual Studio, and resetting Resharper settings. No joy. I have no idea what could've broken here nor how to diagnose. Any help folks can offer would be appreciated. Thanks.

0
9 comments

Hello Nicholas,

 

To begin with, please try clearing ReSharper caches via ReSharper | Options | Environment | General | Clear caches.

Thank you.

1

Angelina,

It ended up being the "read project model directly from disk" Resharper option that caused my problems. I unchecked that, and now it's working properly. Thanks.

0

Thank you for letting me know, Nicholas.

 

Is the same problem reproduced with the latest ReSharper 2020.3 and enabled "Read project model" option?

If the problem is still reproduced could you please:

1. Start VS with ReSharper in internal mode with command devenv /ReSharper.Internal
2. Select in menu ReSharper | Internal | Project Model | Project Model Dump and save it in DumpOptionDisabled.txt file
3. Enable Read solution model directly option
4. Select in menu ReSharper | Internal | Project Model | Project Model Dump and save it in DumpOptionEnabled.txt file

Please share txt files privately via uploads.jetbrains.com and let me know Upload ID.

Thank you.

0

Hi, we are still seeing this issue as of version 2023.3.4.  Was there a resolution?

0
Hello Zach,
thank you for contacting us.
Does this issue happen in all solutions or onlu in specific one?
Also please check if the Web Languages support is turned on in ReSharper | Options | Environment | Products & Features.
Thank you!
0

We have only noticed in one project, seems to be working in another.
Working: Project Microsoft.NET.Sdk.Web, target net6.0
Not working: Project Microsoft.NET.Sdk, target net48
 

Confirmed that Web Languages support is enabled.

0

Zach Johnston Microsoft.NET.Sdk says nothing about web and that's why we do not recognize Razor there.
While Microsoft.NET.Sdk.Web does. How do you work with razor in Microsoft.NET.Sdk?

0

Slava Trenogin  We use a variant of https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb - basically, Visual Studio supports intellisense on projects with the following csproj itemgroup values:

  <ItemGroup>
   <ProjectCapability Include="DotNetCoreWeb" />
   <ProjectCapability Include="SupportsSystemWeb" />
   <ProjectCapability Include="LegacyRazorEditor" />
 </ItemGroup>

 

  <ItemGroup>
   <Reference Include="System.Data.DataSetExtensions" />
   <Reference Include="System.Data.Linq" />
   <Reference Include="System.Transactions" />
   <Reference Include="System.Web" />
   <Reference Include="System.Web.Extensions" />
   <Reference Include="System.Web.Services" />
 </ItemGroup>


CZEMacLeod's custom MSBuild project SDK just formalizes what we are doing manually into an SDK project type. I know it may sound a little wild that we're including DotNetCoreWeb as a ProjectCapability, but for people stuck on ASP.NET MVC 5 (before it pivoted to Core), this workaround is absolute pure gold. See here: https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/blob/main/src/MSBuild.SDK.SystemWeb/Sdk/Sdk.props#L12-L17
 

0
Hello,
thank you for the details.
I've created an issue in YouTrack: https://youtrack.jetbrains.com/issue/RSRP-497161/Resharper-doesnt-analyze-razor-CSHTML-files, you are welcome to comment on it and follow up to receive updates.
Thank you!
0

Please sign in to leave a comment.