简体   繁体   中英

Adding specific NuGet package in Visual Studio 2017 doesn't work

Other NuGet package such as Newtonsoft.Json works fine.

After adding the NuGet package "Microsoft.Windows.SDK.Contracts" to VS2017, this package doesn't show up in "References", and there is no effect in the source code too ie still can't find the types.

When installing the package, there is no error messages, Pacakge Manager output windows says the installation is successful. The package is shown as installed in the NuGet manager.

Have tried to clear nuget cache/deleting.vs folder/uninstall and install again the package/install another version of the package.

Version is VS 15.9.6. WinForms project using .NET framework 4.8.

If a new WinForms project is created then the package can be added successfully. It seems to be related to some historical problem of the project (but have tried to delete.vs folder).

Is there some log/config files to check for the possible problems? Or the only way is to migrate the whole project to a new project or updating VS2017 (don't think this will work)

You can check the package management format of the project and nuget version.

The package Microsoft.Windows.SDK.Contracts requires default package management format set to PackageReference, and NuGet 4.0 or higher.

.NET Framework projects support PackageReference, but currently default to packages.config. You can see how to migrate from packages.config to PackageReference .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM