Support URL based files


It would be nice if nuget.exe could be set to automatically download files listed in the <files> section of the nuspec file if the files were hosted at remote locations (http/https/ftp). This would only be for package creation purposes, but it would make maintaining certain packages easier.

An example of this would be a community JavaScript package that is maintained by somebody else. I have a few packages I maintain that require me to download scripts, update the nuspec, and then create the package. I actually made a tool to automate this process, but it would be nice if this was built into nuget.exe.

This funcationality woudl work as follows:
  1. Package nuspec file would contain uri based files.
    <file url="http://code.jquery.com/jquery-1.9.1.min.js" target="Content/Scripts" />
    <file url="http://code.jquery.com/jquery-1.9.1.js" target="Content/Scripts" />
  2. Package creator would run "nuget pack"
  3. Nuget.exe would download the files from the source url and add them to the package. This would behave exactly like any file stored on the file system would be added to a package.


Haacked wrote Feb 20, 2013 at 4:50 PM

I assume that the url would then get rewritten to reference the locally packed file, right? That's interesting.

pranavkm wrote Feb 20, 2013 at 5:29 PM

Presumably it could still use the src attribute. The pack command would be smart enough to detect if it's referencing a http\ftp src and download it at that point.

ymf8008 wrote Feb 22, 2013 at 12:48 AM

So would the url get rewritten to reference the locally packed file? I don't see how this would work.


ntotten wrote Feb 22, 2013 at 3:16 AM

The URL would only be temporary for when you are creating a package. When you run nuget.exe pack, the files would be downloaded to a temporary location then included in the package in the location specified in the target property.

The idea is only to make it easier to create packages. From the end user prospective this would have no change.

@pranavkm - You could use the src attribute and just detect if the source is a file location or remore location.