Force NETStandard.Library 1.6.0 on NuGet references without build warning

1.2k views Asked by At

I have a .NET Core 1.0 app that I've built for AWS Lambda. However, AWS only supports the Standard.Library 1.6.0, not 1.6.1.

I've been able to explicitly reference .NETStandard.Library 1.6.0 using NuGet--and it successfully works this way in AWS.

However, for most of my NuGet references, I get tons of build warnings saying "Detected package downgrade: NETStandard.Library from 1.6.1 to 1.6.0. Reference the package directly from the project to select a different version." And I get tons of yellow warning signs on my NuGet references, that I'd rather not ignore.

I've tried adding each of the following separately in my .csproj file, but nothing seems to work...

<PropertyGroup>
    <NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
</PropertyGroup>

<ItemGroup>
    <PackageReference Update="NETStandard.Library" Version="1.6.0" />
</ItemGroup>

<ItemGroup>
    <NetStandardImplicitPackageVersion Include="NetStandardLibrary" Version="1.6.0" />
</ItemGroup>

I'd prefer to not ignore these Warnings. It's a lot of noise that could mask other issues. Any suggestions? Is there another type of explicit reference that I'm not aware of?

Thanks in advance.

1

There are 1 answers

0
Martin Ullrich On

Only the version of your attempts setting NetStandardImplicitPackageVersion is the correct way to set the version. If you update to the .NET Core 2.0.0 SDK to build your 1.0 app, the new NuGet version allows you to control the warning using the NoWarn property like this:

<PropertyGroup>
  <NoWarn>$(NoWarn);NU1605</NoWarn>
</PropertyGroup>