Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I have a project that targets .NET 10 and the new package pruning feature produces multiple instances of NU1510. I tried to use NoWarn to disable the warning, but that did not work. Is there some other way to silence the warning?

I noticed that it is properly promoted to an error when using WarningsAsErrors, so I guess this might be bug? Am I missing something?

You must be logged in to vote

It doesn't repro for me with the .NET 10 SDK preview 6 which version are you using? Could you share a simple repro?
If not how do you set the NoWarn? Something could be overriding the NoWarn maybe in your project? If so this contains some info about that dotnet/AspNetCore.Docs#9708 (comment) to use $(NoWarn) to append more warnings if warnings (NU1510 in this case) were added to NoWarn in a Directory.Build.props file without overriding that which was defined in the props file.

I did both NoWarn in csproj and dotnet build /nowarn:NU1510 and it silenced the warning for both cases. The second one works even if NoWarn was being overriden as it will apply the property globally (effectively ign…

Replies: 1 comment · 4 replies

Comment options

It doesn't repro for me with the .NET 10 SDK preview 6 which version are you using? Could you share a simple repro?
If not how do you set the NoWarn? Something could be overriding the NoWarn maybe in your project? If so this contains some info about that dotnet/AspNetCore.Docs#9708 (comment) to use $(NoWarn) to append more warnings if warnings (NU1510 in this case) were added to NoWarn in a Directory.Build.props file without overriding that which was defined in the props file.

I did both NoWarn in csproj and dotnet build /nowarn:NU1510 and it silenced the warning for both cases. The second one works even if NoWarn was being overriden as it will apply the property globally (effectively ignoring all other NoWarn).

My repro in a new folder

dotnet new console
dotnet package add System.Memory@4.6.3
Add NoWarn NU1510 to csproj
dotnet build

And out of curiosity were the warnings false positives or did you just not want to deal with them right now?

You must be logged in to vote
4 replies
@siegfriedpammer
Comment options

Thanks for the help, now I feel stupid.

Problem was that the solution had multiple projects already defining NoWarn in different locations. Using <NoWarn>$(NoWarn);...;NU1510</NoWarn> instead fixed the problem.

@Frulfump
Comment options

No problem, no don't feel stupid, it happens to the best of us!

@siegfriedpammer
Comment options

And out of curiosity were the warnings false positives or did you just not want to deal with them right now?

.NET 10 is currently in preview and I haven't had the time to look into this specific topic so far. Problem is that in my case NuGet adds around 60 warnings to the build, which makes warnings effectively useless, because new warnings tend to go unnoticed as their number just increases slowly over time.

@Frulfump
Comment options

Thanks for explaining, yeah I build with /warnaserror in CI so at least some action is required to remove the warnings either NoWarn, pragma warning disable or fixing the issue so that keeps the number of warnings from increasing and new warnings are then a clear signal for us.

Answer selected by siegfriedpammer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.