无法从远程源检索信息

无法从远程源检索信息

本文介绍了NuGet Pack -- 无法从远程源检索信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行:

nuget pack project.csproj

但是因为项目的目录结构:

but because of the directory structure of the project:

A\B\C\项目

它一直在说:

NuGet.Protocol.Core.Types.FatalProtocolException: 无法从远程源A\B\Packages"检索信息,它实际上应该是A\Packages".如何在建立依赖项时更改 NuGet 查找包的位置.

NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information from remote source 'A\B\Packages', which it really should be 'A\Packages'. How do I change where NuGet looks for packages while establishing dependencies.

我尝试在项目目录和解决方案(在 .nuget 中)中放入 NuGet.config.我将此添加到文件中:

I have tried putting a NuGet.config in both the project directory as well as the Solution (in .nuget). I added this to the file:

<config>
    <add key="repositoryPath" value="A\Packages" />
</config>

在两个地方都没有区别(它总是说 A\B\Packages).

in both places and it made no difference (it always says A\B\Packages).

推荐答案

错误有点奇怪,不过是此处已提及.

The error is a bit weird, but is already mentioned here.

默认情况下,NuGet 似乎需要与 .csproj 文件位于同一位置的包文件夹.

It looks like NuGet by default expects a packages folder at the same location as the .csproj file.

我还有一个自定义项目结构,其中 .sln 位于另一个文件夹中.

I also had a custom project structure where the .sln was located in another folder.

至少我通过创建这样的符号链接来解决这个问题(使用管理员权限打开 cmd):

At least I worked around this by creating a Symbolic link like this (open cmd with admin rights):

cd <your .csproj location>
mklink /d packages "C:\path\to\actual\packages"

这样 NuGet 就会认为包文件夹存在并且应该能够创建你的包.

This way NuGet thinks the packages folder exists and should be able to create your package.

这篇关于NuGet Pack -- 无法从远程源检索信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:13