在 C:\Users\username\.nuget\packages\ 中找不到包.运行 NuGet 包还原以下载包 [英] The package could not be found in C:\Users\username\.nuget\packages\. Run a NuGet package restore to download the package
问题描述
在 C:\Users\username\.nuget\packages\
中找不到版本为 1.0.1 的 CacheManager.Core 包.运行 NuGet 包还原以下载包.
The package CacheManager.Core with version 1.0.1 could not be found in C:\Users\username\.nuget\packages\
. Run a NuGet package restore to download the package.
但我的项目在 D: 驱动器中.除了这个包的错误之外,所有其他包都很好.这是packages.config的快照
but my project is in D: drive. all of other packages are fine except error for this package. here is snapshoot of packages.config
<代码><包><package id="CacheManager.Core" version="1.0.1" targetFramework="net462"/><package id="Castle.Core" version="3.3.3" targetFramework="net462"/><package id="Castle.Windsor" version="3.3.0" targetFramework="net462"/>...
实际上,这些包都在提到的 C:\Users\username.nuget\packages\ 和项目文件位置
Actually, the packages are in both mentioned C:\Users\username.nuget\packages\ and in project file location
推荐答案
在我们的案例中,创建了以下文件:
In our cases following files were created:
obj/LcWebServerExtension.csproj.nuget.cache
obj/LcWebServerExtension.csproj.nuget.g.props
obj/LcWebServerExtension.csproj.nuget.g.targets
obj/project.assets.json
.g.props 文件只列出了 C:\Users\...
目录,没有其他正确配置的目录.
The .g.props file just listed the C:\Users\...
directory, no other of the properly configured directories.
解决问题需要两步:
从15"回退 .csproj 文件的 ToolsVersion;到12".正确的外观:
Set back ToolsVersion of .csproj file from "15" to "12". Right appearance:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import ...
手动删除obj/
文件夹,然后重建
这篇关于在 C:\Users\username\.nuget\packages\ 中找不到包.运行 NuGet 包还原以下载包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!