Open
Description
I ran into several cases where I accidentally benchmarked the wrong version of a NuGet package because NuGet restore warnings (e.g. NU1102 "Unable to find package 'Foo' with version (>= X.Y.Z)" or NU1603 "An approximate best match of X.Y.Z was resolved.") were not reported by BenchmarkDotNet when I use CsProjClassicNetToolchain or CsProjCoreToolchain, and these warnings did not fail the build/run.
I've been looking for a way to treat these warnings as errors, but have not found a way yet.
<WarningsAsErrors>NU1102;NU1603</WarningsAsErrors>
in the benchmark csproj has no effect, because it does not get copied over to generated projects.- Passing
/p:WarningsAsErrors="NU1102;NU1603"
as an MsBuildArgument to the job does not work, because BenchmarkDotNet usesdotnet restore
(which does not respect this option) instead ofnuget restore
ormsbuild /t:Restore
(which would).
Is there another way, short of forking CsProj toolchains?
IMO treating NuGet restore problems as run failures seems like a resonable default behavior too.