Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Revised proposal for Adding dotnet CLI support for projects onboarded to CPM #11873
Revised proposal for Adding dotnet CLI support for projects onboarded to CPM #11873
Changes from 12 commits
11916ba
467dfc6
0dd4eee
f710e80
f311fcb
85e973b
1cbbefe
bb5c20b
cb92d59
8c62378
099a091
6e501b9
a599d0e
24c13de
c7af6be
0d3fcf2
2ad4cbf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think add package should update versions.
This is something that's not readily apparent to the user.
Imo, the behavior should be either version override or an explciit command to update in CPM depending on whether --version has been passed it or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We went down on this path because
dotnet add package
currently updates the package version if the reference already exists. In the case of CPM, updating version in theDirectory.Packages.Props
file is an option.Your suggestion to add
VersionOverride
if the package reference already exists is also a good one. @jeffkl what do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, its just more work for a user to use a different gesture for add vs update. They might be running it on a bunch of projects via automation and they'd have to determine whether not that package is already referenced. So I think add package should just update the version for them.
I'd rather not make
VersionOverride
easier to use personally. Its an escape hatch/last restore and I'd much rather people try to unify their graph. If we wanted to use VersionOverride, I would see that as a command-line argument for you opt into that functionality.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I bring it up is because we have issues and customer interviews that have suggested otherwise.
There's also an ask for a
dotnet update package
command, which is something we'd want to do eventually as well.I think dotnet add package should match the VS experience for install package.
When you go to an individual project and run
add package
, you don't expect the package to be updated for other projects as well.You could introduce potential compatibility issues but you wouldn't know about that until you get to your build, because there's no prevalidation for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current behavior in VS - "Clicked on Update package in PM UI. New
PackageVersion
added to csproj file andDirectory.packages.props
file was not updated". I think it is a bug because the tooling addsPackageVersion
XML element not theVersionOverride
.EDIT - When I launched @jeffkl's PR branch NuGet/NuGet.Client#4642 in an experimental instance, I noticed that updating package version in Visual Studio for CPM project didn't update .csproj file also. But the updated version is present in the assets.json file and solution explorer dependencies node except the props file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed an issue for the
<PackageVersion />
being added to the project: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1544117There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffkl - Hope you are okay with changing the logic to add
VersionOverride
when add package is trying to update the package version. I will update the proposal shortly.cc @pragnya17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the spec to capture the summary of this conversation. No changes should be made to the
Directory.Packages.Props
file. AddVersionOverride
attribute to the existingPackageReference
item in .(cs/vb)proj file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes if VersionOverride is already specified, we should update that value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Updated the spec.
Can I get approval on the updated spec?