Recently I needed to switch between frameworks so I made a bunch of scripts that copies projects and packages.config to eg sample.Net40.proj and packages.Net40.proj.
nuget -install /path/to/packages.Net40.config
fails with the message
WARNING: Second path fragment must not be a drive or UNC name.
Parameter name: path2
Unable to find package '/path/to/packages.Net40.config'.
I checked the code and it's because NuGet insists on the
// If the first argument is a packages.config file, install everything it lists
// Otherwise, treat the first argument as a package Id
if (Arguments.Count == 0 || Path.GetFileName(Arguments).Equals(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase))
It does not make much sense to me to take a config file on the commandline and then put restrictions on the filename, but anyway an esay fix for myself is changing that into
where PackageReferenceFileExtension is
. That still restricts the file name, but at least to something imo more sensible. But that also means atm I have to keep a fork of NuGet and put my own NuGet.exe in my repositories instead of just
downloading it, maintain it etc. Not so nice.
So I was wondering if it's worth making a pull request for this? (Also I noticed that the
is repeated multiple times all over the NuGet projects which is a bit ugly. So I'd probably refactor that out as well, but then I'm not sure if I break things)