简体   繁体   English

在 Visual Studio 2017 中添加特定的 NuGet package 不起作用

[英]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.

相关问题 Visual Studio 2017 中的 Nuget package 错误 - Nuget package error in Visual Studio 2017 Visual Studio 2017 无法正确解析特定引用 - Visual Studio 2017 doesn't resolve a specific reference correctly SignalR在Visual Studio 2017下不起作用 - SignalR doesn't work under Visual Studio 2017 NuGet 包管理器 - 未找到项目“默认”。 - 视觉工作室 2017 - NuGet Package Manager - Project 'Default' is not found. - Visual Studio 2017 在Visual Studio 2012 Express上通过Nuget的NUnit.Runners不起作用 - NUnit.Runners via Nuget on Visual Studio 2012 express doesn't work 使用Visual Studio 2017的Azure Function项目的NuGet包还原失败 - NuGet package restore fails for Azure Function project using Visual Studio 2017 Visual Studio - 将 Nuget package 添加到 MacOs 中的项目时,拒绝访问路径“/Users/.local/share/NuGet” - Visual Studio - Access to the path '/Users/.local/share/NuGet' is denied when adding Nuget package to the project in MacOs Visual Studio 2017 不显示编辑/添加的图标 - Visual Studio 2017 doesn't show edited/added icon Visual Studio Nuget无法安装任何软件包 - Visual Studio Nuget unable to install any package 使用nuget程序包自动配置VSIX的Visual Studio - configure visual studio with nuget package, VSIX automatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM