简体   繁体   English

NuGet nuspec依赖 - 如何包含私有NuGet库

[英]NuGet nuspec dependency - how to include a private NuGet gallery

Fixed - see Sara Lui's link to document in comments. 已修复 - 请参阅Sara Lui在评论中指向文档的链接。

I have created several NuGet packages which are available on our private Corporate NuGet gallery. 我已经在我们的私人企业NuGet画廊中创建了几个NuGet包。

Several of these packages are dependent upon one common package. 其中一些软件包依赖于一个通用软件包。

However, when I add this to my Nuspec file: 但是,当我将其添加到我的Nuspec文件中时:

<?xml version="1.0"?>
<package >
  <metadata>
    ...
    <dependencies>
      <dependency id="MyCommonPackage" version="1.0">
      </dependency>
    </dependencies>
  </metadata>
</package>

Then it fails to install because it can't find "MyCommonPackage" - it's not looking for it in our corporate gallery: 然后它无法安装,因为它找不到“MyCommonPackage” - 它不是在我们的公司图库中寻找它:

NotFound https://api.nuget.org/v3-flatcontainer/MyCommonPackage/index.json NotFound https://api.nuget.org/v3-flatcontainer/MyCommonPackage/index.json

NotFound https://dotnetmyget.blob.core.windows.net/artifacts/roslyn/nuget/v3/flatcontainer/MyCommonPackage/index.json NotFound https://dotnetmyget.blob.core.windows.net/artifacts/roslyn/nuget/v3/flatcontainer/MyCommonPackage/index.json

Visual Studio has this gallery referenced, but I suspect I need to reference it in the nuspec file (just not seeing how to do this). Visual Studio引用了这个库,但我怀疑我需要在nuspec文件中引用它(只是没有看到如何做到这一点)。

I fixed it by referring to link provided by @Sara Lui: 我通过参考@Sara Lui提供的链接来修复它

please check this doc: https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package and make sure the required file 'MyCommonPackage' is under the folder structure before we run the nuget pack command to generate the .nupkg file. 请查看此文档: https ://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package并确保在运行nuget包之前所需的文件'MyCommonPackage'位于文件夹结构下命令生成.nupkg文件。

I removed the package references, deleted the folders from the NuGet gallery and then re-published them from the bottom-up. 我删除了包引用,从NuGet库中删除了文件夹,然后从下至上重新发布它们。 This time it just worked like a dream (with no changes apart from re-publishing). 这次它只是像梦一样工作(除了重新发布之外没有任何变化)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM