简体   繁体   中英

Nuget install-package and network shares

We have a private nuget repository for sharing internal components. For now, we are just using a network share.

I am running into some problems though: Everything works fine if I use the Package Manager Dialog box -- I can search for my packages, install them, and build.

However, if I use the Package Manager Console command: install-package My.Package (where My.Package is the exact string in the <id> tag of the nuspec file, I get an error indicating the nuget could not find the package.

If I include the version number in install-package: install-package My.Package.1.0.0, then it works from the console.

BUT, our build server fails to download our packages with the same error I get from install-package. (our build server uses package restore)

I have compared my nuspec files with some publicly available packages that work find. The only difference I can find is that our nuget packages are on a network share, but public ones are on a web server.

Is there a behavior difference if you use a network share?

I figured out what the problem was -- it was mostly user error.

I went through my nuget config, and I found this:

<activePackageSource>
  <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</activePackageSource>

That setting tells nuget to only search nuget.org, and not our private feed. Had to change it to this:

<activePackageSource>
  <add key="All" value="(Aggregate source)" />
</activePackageSource>

I'm still not sure why it worked before (sometimes) if you included the version number (maybe it had to do with whether the package was already locally cached?? It seems as though it should not have worked at all until I made this change. This fixed it though.

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