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

Enable updating packagereference versions from the command line (for csproj) #4358

Closed
brgrz opened this issue Jan 22, 2017 · 16 comments
Closed
Labels
Product:NuGet.exe NuGet.exe Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Feature
Milestone

Comments

@brgrz
Copy link

brgrz commented Jan 22, 2017

Currently the .NET Core CLI does not support automatic package updates to the the new .NET Core .csproj format (reading the file, updating the packages and updating the references within the file) as per
https://github.com/dotnet/cli/issues/5425 (that is using dotnet restore or any other command/means)

Is there a plan for nuget.exe to support the missing functionality like it does for the old (Visual Studio) .csproj?

@emgarten
Copy link
Member

@brgrz 4.0.0 will support PackageReferences. Try https://dist.nuget.org/win-x86-commandline/v4.0.0-rc3/NuGet.exe

@brgrz
Copy link
Author

brgrz commented Jan 22, 2017

What's the correct way to use this? I tried and got this:

PS C:\Users\brgrz\Documents\testApp> .\nuget update testapp.csproj
MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319'.
Exception has been thrown by the target of an invocation. The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\brgrz\Documents\testApp\testapp.csproj

@clairernovotny
Copy link

clairernovotny commented Jan 22, 2017

This raises an interesting question .... what if nuget.exe isn't run from a developer command prompt or where msbuild 15 isn't in the path?

@brgrz
Copy link
Author

brgrz commented Jan 22, 2017

My setup here is a new .NET Core RC4 (latest bits from CLI's GitHub) project and I have the nuget (3.5.0) in my path but I copied the Nuget.exe @emgarten linked to the root of my app and it picks up the right one when I run .\nuget update testapp.csproj:

PS C:\Users\brgrz\Documents\testApp> .\nuget
NuGet Version: 4.0.0.2215

oh and btw I do not have VS 2017 RC installed here

@emgarten
Copy link
Member

what if nuget.exe isn't run from a developer command prompt or where msbuild 15 isn't in the path?

You can specify -MSBuildPath and give the bin folder of MSBuild to override. nuget.exe can auto detect and find MSBuild 15.0, but it favors the version on your path.

.\nuget update testapp.csproj

There is no PackageReference replacement for update yet, the command to modify references is only in dotnet. I suggest using floating versions such as 1.0.* or 1.0.0-beta-* to automatically update packages each time you run nuget.exe restore for your development scenarios.

@brgrz
Copy link
Author

brgrz commented Jan 23, 2017

You can specify -MSBuildPath and give the bin folder of MSBuild to override. nuget.exe can auto detect and find MSBuild 15.0, but it favors the version on your path.

I don't know which MSBuild I have installed. As said, I only installed the .NET Core SDK and VS Code.

There is no PackageReference replacement for update yet, the command to modify references is only in dotnet. I suggest using floating versions such as 1.0.* or 1.0.0-beta-* to automatically update packages each time you run nuget.exe restore for your development scenarios.

I don't quite understand what you're saying. How do I actually solve the issue I'm having by using the nuget.exe you provided?

@emgarten
Copy link
Member

How do I actually solve the issue I'm having by using the nuget.exe you provided?

Would you provide more details on the issue you are having and what you expect?

@brgrz
Copy link
Author

brgrz commented Jan 23, 2017

My issue is simple, really. Discover new updates for packages referenced through PackageReferences, update them (cherry picking would be nice but at this time it is not mandatory) and then update the PackageReferences to reflect the changes. VS Code/nuget.exe/CLI only.

@rrelyea rrelyea changed the title Support the new .NET Core csproj format Enable updating packagereference versions from the command line (for csproj) Jan 23, 2017
@rrelyea rrelyea added this to the 4.0.1 milestone Jan 23, 2017
@rrelyea rrelyea added Product:NuGet.exe NuGet.exe Type:DCR Design Change Request labels Jan 23, 2017
@rrelyea rrelyea added Type:Feature and removed Type:DCR Design Change Request labels Feb 9, 2017
@stevenscreek
Copy link

stevenscreek commented Mar 23, 2017

We're also hoping to see this. Floating versions do not work for us, as we want reproducible builds, no matter what package version updates have happened since the last build.

We've ended up writing a tool that parses csproj files, looks for PackageReference, queries our nuget server, and updates the versions. We'd love to throw this away.

@steve-torchia
Copy link

@stevenscreek We're in the same boat. Is your tool on GitHub by any chance? Was about to roll my own when I came across your post

@stevenscreek
Copy link

@steve-torchia Unfortunately, it's not (and there's not much I can do to make that change).

@haugan
Copy link

haugan commented May 28, 2017

So weird that this functionality isn't available in VS Code. Are we supposed to track and update each package reference in .csproj manually?

@jahmai-ca
Copy link

I slapped this together over the weekend, because doing updates with Visual Studio 2017 is agony (takes 10 minutes just to calculate the updates, 20 mins to execute them, and then half the time doesn't properly update everything).

https://gist.github.com/jahmai/6868dbaeb9032eabb1cd0c6b6a2088e8

Disclaimer: Works for me, might not work for you.

@pbelousov
Copy link

Hi All, are there any news or expectations on this feature?

@zhili1208 zhili1208 added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Nov 9, 2017
@zhili1208 zhili1208 modified the milestones: Future-0, 4.6 Nov 9, 2017
@zhili1208
Copy link
Contributor

close as dupe of #4103

@AraHaan
Copy link

AraHaan commented Feb 1, 2021

@jahmai nice, but what about on your gist on allowing updates for imported props that contains PackageReferences too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product:NuGet.exe NuGet.exe Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Feature
Projects
None yet
Development

No branches or pull requests