简体   繁体   中英

NuGet nuspec dependency - how to include a private NuGet gallery

Fixed - see Sara Lui's link to document in comments.

I have created several NuGet packages which are available on our private Corporate NuGet gallery.

Several of these packages are dependent upon one common package.

However, when I add this to my Nuspec file:

<?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:

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

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).

I fixed it by referring to link provided by @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.

I removed the package references, deleted the folders from the NuGet gallery and then re-published them from the bottom-up. This time it just worked like a dream (with no changes apart from re-publishing).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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