NuGet Pack

编程入门 行业动态 更新时间:2024-10-23 19:18:29
本文介绍了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

本文发布于:2023-11-02 14:55:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552697.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NuGet   Pack

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!