Installing private feed Nuget packages from packag

2019-07-04 04:33发布

问题:

I have a private nuget feed on one of our internal servers.

I can install packages in this feed from command line like this

nuget install "PackageName" -source "\\DevServer\NugetFeed"

However if I try to install the packages from our packages.config file like this

nuget install "MyProject\Packages.config" -source "\\DevServer\NugetFeed"

It errors with can't find package for each of the packages in my packages.config file. It looks like it's ignoring the -Source switch and looking in a different nuget feed.

My packages.config looks like this

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Package1" version="1.0.0" />
  <package id="Package2" version="1.0.0" />
</packages>

Any ideas how I can make this work? Can you include the source location in packages.config or something similar?

回答1:

This is likely to be related to the naming of files on the feed. Your first command line doesn't specify a version number, so it will pick up anything named "PackageName".

Make sure the files in your feed are called "Package1.1.0.0" and "Package2.1.0.0", and that should do the trick.