[英]Adding specific NuGet package in Visual Studio 2017 doesn't work
Other NuGet package such as Newtonsoft.Json works fine.其他 NuGet package 例如 Newtonsoft.Json 工作正常。
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. 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.安装package时没有报错,包管理器output windows说安装成功。 The package is shown as installed in the NuGet manager.
package 显示为安装在 NuGet 管理器中。
Have tried to clear nuget cache/deleting.vs folder/uninstall and install again the package/install another version of the package.已尝试清除 nuget 缓存/deleting.vs 文件夹/卸载并再次安装软件包/安装另一个版本的 package。
Version is VS 15.9.6.版本是 VS 15.9.6。 WinForms project using .NET framework 4.8.
WinForms 项目使用 .NET 框架 4.8。
If a new WinForms project is created then the package can be added successfully.如果创建了新的 WinForms 项目,则可以成功添加 package。 It seems to be related to some historical problem of the project (but have tried to delete.vs folder).
这似乎与项目的一些历史问题有关(但已尝试删除.vs文件夹)。
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)
或者唯一的方法是将整个项目迁移到新项目或更新VS2017(不要认为这会起作用)
You can check the package management format of the project and nuget version.可以查看项目的package管理格式和nuget版本。
The package Microsoft.Windows.SDK.Contracts requires default package management format set to PackageReference, and NuGet 4.0 or higher. 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. .NET 框架项目支持 PackageReference,但目前默认为 packages.config。 You can see how to migrate from packages.config to PackageReference .
您可以了解如何从 packages.config 迁移到 PackageReference 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.