Error : The project was restored using Microsoft.NETCore.App version x.x.x, but with current settings, version y.y.y would be used instead.
To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish.
Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore:
Roslyn analyzers run as part of compilation, so the source tree on the build machine needs to be in a buildable state. A step
(probably "dotnet.exe publish") between your main build and Roslyn analyzers may have put the source tree in an unbuildable state.
Perhaps duplicating the step that does a Nuget Restore, just before the Roslyn Analyzers step, will put the source tree back in a buildable state.
"csc.exe" exited with error code 1 -- An instance of analyzer AAAA cannot be created from C:\BBBB.dll : Could not load file or assembly
'Microsoft.CodeAnalysis, Version=X.X.X.X, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Ensure your compiler supports Roslyn analyzers. "csc.exe /version" should report at least v2.6.x. In some cases, individual .csproj files can override
the build machine's Visual Studio installation, by referencing a package from Microsoft.Net.Compilers. If using a specific version of the compiler was
unintended, remove references to Microsoft.Net.Compilers. Otherwise, make sure the referenced package is also at least v2.6.x.
Try to get the error log, which you can find in the /errorlog: parameter from the csc.exe command line (found in the Roslyn build task's log).
It may look something like: /errorlog:F:\ts-services-123\_work\456\s\Some\Project\Code\Code.csproj.sarif
The C# compiler is not recent enough (it must be >= 2.6)
The latest versions of the C# compiler are released here: https://www.nuget.org/packages/Microsoft.Net.Compilers. To get the installed version you are using:
Ensure that you do not have any reference to a Microsoft.Net.Compilers NuGet package that is < v2.6.
MSBuild/VSBuild Logs Not Found
Because of how the task works, this task needs to query Azure DevOps for the MSBuild log from the MSBuild build task. If this task runs immediately
after the MSBuild build task, the log will not yet be available; Place other build tasks, including SecDevTools build tasks, like Binskim,
Antimalware Scan, and others), between the MSBuild build task and the Roslyn Analyzers build task.