dotnet/upgrade-assistant

Analyzer references relative Nuget.packages path cause build failure

Opened this issue · 0 comments

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