Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support -ExcludeVersion for Restore and Update commands #1286

Closed
deepakaravindr opened this issue Aug 28, 2015 · 19 comments
Closed

Support -ExcludeVersion for Restore and Update commands #1286

deepakaravindr opened this issue Aug 28, 2015 · 19 comments
Assignees
Milestone

Comments

@deepakaravindr
Copy link

@KorsG

Hi,

Would it be possible to implement the -ExcludeVersion option for Restore and Update commands, just like the Install command ?

@yishaigalatzer
Copy link

This doesn't make sense for the restore command (in package.config), but it could be interesting for the update command.

@yishaigalatzer yishaigalatzer added this to the Client-VNext milestone Aug 31, 2015
@maksim-dell
Copy link

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?

@yishaigalatzer
Copy link

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?

@maksim-dell
Copy link

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.

@yishaigalatzer
Copy link

When we do support it you will not be able to

  1. Use restore in visual studio
  2. Have multiple package versions in a solution

@maksim-dell
Copy link

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

@yishaigalatzer
Copy link

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)

@yishaigalatzer
Copy link

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?)

@jozefizso
Copy link
Contributor

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.

@yishaigalatzer
Copy link

That's a bug, not intentional

@yishaigalatzer yishaigalatzer modified the milestones: 3.4, Client-VNext Nov 29, 2015
@yishaigalatzer yishaigalatzer modified the milestones: 3.4 Beta, 3.4 RTM Feb 25, 2016
@deepakaravindr deepakaravindr modified the milestones: 3.4 RTM, 3.5 Beta Mar 8, 2016
@yishaigalatzer yishaigalatzer modified the milestones: 3.5 Beta, 3.5 RC Apr 8, 2016
@rmarinho
Copy link

this feature will be interesting.. we need to have more options to work in CI without messing with csproj

@yishaigalatzer
Copy link

@rmharinho take a look at this blog https://oren.codes/2016/02/08/project-json-all-the-things/

@rmarinho
Copy link

rmarinho commented Jun 24, 2016

How will that help me? I m not even using project.json.

@yishaigalatzer
Copy link

If you move to use project.json these issues go away.

@rmarinho
Copy link

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

@rmarinho
Copy link

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.

@yishaigalatzer
Copy link

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.

@yishaigalatzer
Copy link

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 support@nuget.org

@nkolev92
Copy link
Member

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.

#5602
#5553

@nkolev92 nkolev92 modified the milestones: Future-1, 4.6 Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants