WARNING: I have posted this on Reddit a few weeks ago but never got a response.
I have obtained a large .NET solution from a third-party, and I'm having the following issues with it:
PackageReference
or ProjectReference
results in the following popup:All the above features work fine for symbols defined in the System namespace or the current namespace. Other solutions on my local machine do not exhibit this behavior and work fine. Things I have tried:
.vs
folderNone of these things have worked, so I'm beginning to think something more fundamental is going wrong with this particular solution. I can't for the life of me figure out what's wrong with it. What could cause symbols to not get recognized for a solution in Visual Studio 2022? How can I further isolate the root cause of the problem?
I finally figured it out. Here's how:
ConsoleApp1
ClassLibrary1
containing one class called Class1
ClassLibrary1
from ConsoleApp1
, and added code in Program.Main
referencing Class1
Class1
symbol in ConsoleApp1
was not highlighted and not navigable, similar to my real use case.I then started deleting stuff from the original solution. I thought it might take forever, considering the size of the codebase and the sheer amount of stuff it contains. First I deleted Directory.Build.props
, Class1
was still not navigable, though my dummy build was fine. The Directory.Build.props
file also imports a Directory.Build.targets
file, so I deleted that as well. Lo and behold, Class1
lit up in green and became navigable. So then I restored Directory.Build.targets
, and Class1
was no longer navigable, and I started deleting various property and item groups from Directory.Build.targets
until I identified the offending lines:
<PropertyGroup>
<DisableRoslynDesignTime Condition="...">true</DisableRoslynDesignTime>
</PropertyGroup>
It turns out that, because most of the other developers on the project use Resharper, they want to turn off Roslyn at design time because Resharper has it's own analyzer. Since I prefer not to use Resharper, I had disabled it for this particular solution.
There's an article which says more about this configuration option.