dotnet / upgrade-assistant

A tool to assist developers in upgrading .NET Framework applications to .NET 6 and beyond
MIT License
1.11k stars 163 forks source link

Analyzer references relative Nuget.packages path cause build failure #1602

Open rcocks-hl opened 2 months ago

rcocks-hl commented 2 months ago

Describe the bug

After upgrading from an old non-SDK project to SDK project, the new project has <Analyzer> elements which refer via relative path to Nuget.packages.

However the upgrade also moves references to PackageReference format, which means that Nuget.packages is no longer populated with the analyzer package after the conversion of the last project.

This causes error messages when building with msbuild about the dll not being found:

CSC : error CS0006: Metadata file '..\..\NuGet.packages\SonarAnalyzer.CSharp.9.32.0.97167\analyzers\SonarAnalyzer.dll' could not be found

Further technical details

.Net framework (net48) project