Repository navigation
Description
NuGet Product Used
dotnet.exe
Product Version
.NET SDK: Version: 10.0.103 Commit: c2435c3e0f Workload version: 10.0.100-manifests.c992be6d MSBuild version: 18.0.11+c2435c3e0
Worked before?
No response
Impact
It bothers me. A fix would be nice
Repro Steps & Context
Describe the bug
The NU1701 warning is emitted during dotnet restore and dotnet build even when the corresponding PackageReference specifies NoWarn="NU1701".
To Reproduce
- Create or open an SDK-style .NET WPF project.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>2.Add a PackageReference that produces NU1701 with suppression.
<ItemGroup>
<PackageReference Include="MicrosoftOfficeCore" Version="15.0.0" NoWarn="NU1701" />
</ItemGroup>- Run dotnet restore.
Expected behavior
Restored D:\source\repos\WpfApp1\WpfApp1.csproj.
NuGet package restore finished.
Actual behavior
Restore succeeded with 1 warning(s) in 0.4s
D:\source\repos\WpfApp1\WpfApp1.csproj : warning NU1701: Package 'MicrosoftOfficeCore 15.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net8.0-windows7.0'. This package may not be fully compatible with your project.
Further technical details
details of dotnet --info
.NET SDK: Version: 10.0.103 Commit: c2435c3e0f Workload version: 10.0.100-manifests.c992be6d MSBuild version: 18.0.11+c2435c3e0
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.103\
- IDE VS 2026 18.3.0
Activity
kartheekp-ms commentedon Feb 12, 2026
I am unable to reproduce the issue following the steps mentioned in the issue description both in
dotnet restoreand VS 2026.Added global.json to pin the .NET SDK version mentioned in the issue description.
{ "sdk": { "version": "10.0.103" } }dotnet restore raises
NU1701warning when the package reference doesn't have NoWarn attribute.dotnet restore doesn't raise
NU1701warning when the package reference has NoWarn attribute.@mk-ghb please let me know if I am missing anything in the repro steps.
mk-ghb commentedon Feb 12, 2026
I've added global.json as suggested and discovered an interesting inconsistency. After cleaning the bin and obj directories, the warning behavior varies depending on which restore tool is used first:
If VS 18.3.0 or msbuild -restore is run first: The NU1701 warning appears, and persists even when subsequently running dotnet restore
If dotnet restore is run first: No warning is present
cmconti commentedon Feb 12, 2026
I'm seeing the same thing with using msbuild to restore.
It was working with VS 18.2.1 and started failing after updating to 18.3.0
Note: I can not reproduce (yet) with a sample project, but it happens every time with my larger multi-solution, multi-project code base...
I can provide a verbose msbuild log if needed (or other logging), but I cannot post it publicly here...
kartheekp-ms commentedon Feb 13, 2026
I am able to reproduce this issue in VS 18.3/18.4 where as
dotnet restoredoes not raise this warning.9 remaining items
nkolev92 commentedon Feb 19, 2026
Hey folks, thank for reporting this and sorry for the issue you're experiencing.
I have a fix in flight in NuGet/NuGet.Client#7153.
In the meantime, as a workaround you could specify the fully qualified name of the framework in the TargetFramework string.
So:
fails,
but the following should work
nkolev92 commentedon Feb 27, 2026
Hey all,
Thanks for your patience.
Quick recap:
The fix will be released in:
Visual Studio & MSBuild 18.4
.NET SDK 10.0.300
Both of those should be happening 2nd week of March.
Workarounds:
Option 1: #14756 (comment)
Option 2: Use project level suppressions.
ToreDemant commentedon Mar 11, 2026
I believe that we have hit this issue when updating from VS 18.3.0 to 18.4.0 which also updates sdk from 10.0.103 to 10.0.200. We see the issue when using
dot net build.nkolev92 commentedon Mar 11, 2026
@ToreDemant
dotnet/dotnet#5021
The fix is merged, but seems like it's not part of the 10.0.200 build.
I'm trying to figure out when 10.0.201 ships.
Sorry about that.
nkolev92 commentedon Mar 12, 2026
Hey @ToreDemant
This fix will be in 10.0.202 and it is scheduled for April.
Apologies for the delay.