Open anangaur opened 7 years ago
A restore is needed to update the suppressions, a rebuild should have done that however. @mishra14 would you try this out?
@emgarten @anangaur and I discussed this.
It seems that we do not get the NoWarn property from msbuild. Possibly because the property is added with multiple conditions that @anangaur will post here.
The csproj file reads like the following:
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp2.0|AnyCPU'">
<NoWarn>1701;1702;1705;NU1701</NoWarn>
</PropertyGroup>
Issues:
This should not add warnings under conditions: https://github.com/Microsoft/VSProjectSystem/issues/241
[This bug] Even with the current conditions, the warnings should be suppressed but it is not.
@mishra14 - if this is external, please use a label, not just zenhub. can you please look at @anangaur second point and determine how many fixes are necessary, and if this should be one of them.
The reason is that we do not pass conditions to msbuild when requesting properties. I will see if it is possible to get this done as part of #5501
Update -
I looked more into this and this is a VS only problem. Since, in dotnet restore and msbuild /t:restore calls we can pass in additional properties.
Looked more into this -
The core issue is that in multi-targeting projects, the project system adds a condition on the first tfm of the project. I have filed an issue with them - https://github.com/dotnet/project-system/issues/2804
I will wait for their response/traction.
Just to clarify the status here;
https://github.com/NuGet/Home/issues/5712#issuecomment-320808057
Framework conditioned no warns are not supported in either CLI or VS.
Repro that shows this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.2;netcoreapp2.1</TargetFrameworks>
<NoWarn Condition="'$(TargetFramework)' == 'netcoreapp2.2'">NU1701</NoWarn>
<AssetTargetFallback>net46</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGet.Credentials" Version="4.6.2" />
</ItemGroup>
</Project>
From: https://developercommunity.visualstudio.com/content/problem/88109/cannot-suppress-nu1701-from-project-properties.html
Repro steps:
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
Expected:Warnings should disappear Actual: Warnings still show up:
Looking at the asset file, the warning is persisted:
Edit by @nkolev92; repro below