@KorsG
Hi,
Would it be possible to implement the -ExcludeVersion option for Restore and Update commands, just like the Install command ?
This doesn't make sense for the restore command (in package.config), but it could be interesting for the update command.
This doesn't make sense for the restore command
@yishaigalatzer, would you mind elucidating why? How can I perform something like this:
cd sln_dir
nuget restore
and get my packages restored without version?
I see what you mean now, you want to be able to "download" packages defined in packages.config without a version, so commands and paths just work without knowing the package version?
Exactly, let us suppose that my package.config looks like
<?xml version="1.0" encoding="utf-8"?>
<packages>
<!--frozen versions-->
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
...
</packages>
and the directory structure is similar to
|~sln_dir/
| |~ConsoleApplication1/
| | |-ConsoleApplication1.csproj
| | |-packages.config
| | packages
| |-ConsoleApplication1.sln
and I want to have paths like ...ConsoleApplication1\packages\Newtonsoft.Json\lib instead of ConsoleApplication1\packages\Newtonsoft.Json.7.0.1.
Nor do I want to write a huge nuget.targets file for msbuild with overridings of RestoreCommand variable.
When we do support it you will not be able to
Have multiple package versions in a solution
that's not a big deal for my project, this would not happen, "I'm feeling lucky":). The cruel problem that I have is that I have to commit and merge huge distracting csproj diffs in git instead of making a single change in packages.config.
Use restore in visual studio
looks ok to me as well
You can start looking at using project.json (if your project is not asp.net 4), it resolves the issues you describe above (see how nuget.client repo is built for reference)
also @maksim-dell one thing I just realized you can use install and restore interchangeably, so the main ask here is to support update on command line (and perhaps in vs?)
Nuget 2.8 supported -ExcludeVersion when installing packages from package.config file. The documentation does not indicate that -ExcludeVersion is not longer supported in Nuget 3.2 when installing from package.config file.
These commands behave correctly and install the package without using version number:
v28\nuget.exe install Pester -o packages -ExcludeVersion
v28\nuget.exe install packages.config -o packages -ExcludeVersion
v32\nuget.exe install Pester -o packages -ExcludeVersion
v32\nuget.exe install Pester -Version 3.3.11 -o packages -ExcludeVersion
This no longer works as expected without any warning:
v32\nuget.exe install packages.config -o packages -ExcludeVersion
packages.config file:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Pester" version="3.3.11" />
</packages>
I find it strange this functionality was removed.
That's a bug, not intentional
this feature will be interesting.. we need to have more options to work in CI without messing with csproj
@rmharinho take a look at this blog https://oren.codes/2016/02/08/project-json-all-the-things/
How will that help me? I m not even using project.json.
If you move to use project.json these issues go away.
Yeah but project.json is going to die so.... and i m running xplat sln with Xamarin and UWP and all that stuff.. Xamarin.Forms
I hacked around i manually set the references to the folder of the nuget without version, then i can install a version with -ExcludeVersion on the folder and it will just work without messing with csproj's ..
Our use case is running in teamcity, generate new Nuget's and install them in a sample project to run unit tests and uitest.
It is not going to die as a package source (the uwp model, not the aspnet core model). There is a change but will be in how it's formatted rather than how it works. So the pattern is right.
I don't know about when xamarin studio will support it, that's something valid to follow up on.
Missed your last comment. I'd be happy to get on a call with you and help out for your exact scenario. Email me at [email protected]
Thanks for filing this issue.
Given the direction NuGet has gone in with Package Reference and project.json, we believe the core asks in this issue are a more granular control of versioning during restore.
Related issues here:
Please comment there with your scenarios.
https://github.com/nuget/home/issues/5602
https://github.com/nuget/home/issues/5553
Most helpful comment
I see what you mean now, you want to be able to "download" packages defined in packages.config without a version, so commands and paths just work without knowing the package version?