Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft.Windows.SDK.Contracts and Must Use PackageReference

Tags:

nuget

It's been a while since I've gotten into nuget hell but I'm back to this again...

I'm not exactly sure what caused this issue other than I did a visual studio 2019 update before I left on Friday. Now today, I've been fighting an issue where my library won't compile due to "Must Use PackageReference".

I've found a few articles out there on this but nothing that seems to specifically address this problem.

This issue could also be due to accidentally adding some .netcore librairies (entity framework .core) to the .netframework library. I had a hard time removing those libraries using nuget.

I also tried to reload the nuget library by:

nuget-package -reinstall Microsoft.Windows.SDK.Contracts

That reloads the package ok, but when I recompile the library the error "Must use PackageReference" comes back again.

In the output window I have this when compiling:

...\path...\packages\Microsoft.Windows.SDK.Contracts.10.0.19041.1\build\Microsoft.Windows.SDK.Contracts.targets(4,5): error : Must use PackageReference

I'm not even seeing this referenced in any of my source files so I'm not sure I even need it. However, I can't uninstall it as it seems to have octopus tentacles in numerous other libraries.

What am I running into here and how do I get this resolved?

like image 411
Zonus Avatar asked Oct 19 '25 02:10

Zonus


1 Answers

My fix was to convert the projects to PackageReference as seen here: https://learn.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference The problem went away after doing this and I haven't seen it since. Still a little uneasy on why this happened... But I don't have time to dwell on it.

like image 106
Zonus Avatar answered Oct 22 '25 03:10

Zonus