-
Notifications
You must be signed in to change notification settings - Fork 694
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
Add a warning message for PMC install/update -source #1976
Conversation
|
||
if (Source != null) | ||
{ | ||
var projectNames = string.Join(",", Projects.Where(e => e.ProjectStyle == ProjectStyle.PackageReference).Select(p => NuGetProject.GetUniqueNameOrName(p))); |
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.
Will this ProjectStyle be set for every case? or how about instead of ProjectStuyle, check for NuGetProject type being BuildIntegrated?
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.
It's always set.
I personally prefer to use project style because it's easier to read?
What would the error message be then?
Do we mention both package reference and project json?
@@ -116,6 +118,7 @@ protected override void ProcessRecordCore() | |||
await _lockService.ExecuteNuGetOperationAsync(() => | |||
{ | |||
SubscribeToProgressEvents(); | |||
ValidateArgumentsAreSupported(); |
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.
Should we differentiate between update for all projects vs individual selected project? And then according to selected project, takes the call to show this warning?
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.
That's already done in an non-intuitive way.
Had me confused initially as well.
https://github.com/NuGet/NuGet.Client/blob/bf99156406e4e702bd3e11ad1ffe79f7571941d1/src/NuGet.Clients/NuGet.PackageManagement.PowerShellCmdlets/Cmdlets/UpdatePackageCommand.cs#L84-L91
@@ -265,6 +266,15 @@ protected void NormalizePackageId(NuGetProject project) | |||
Id = metadata.First().Identity.Id; | |||
} | |||
|
|||
protected virtual void ValidateArgumentsAreSupported() | |||
{ | |||
if (Project.ProjectStyle == ProjectStyle.PackageReference && Source != null) |
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.
Same as above, using NuGetProject type might makes more sense.
{ | ||
if (Project.ProjectStyle == ProjectStyle.PackageReference && Source != null) | ||
{ | ||
var warning = string.Format(CultureInfo.CurrentUICulture, Resources.Warning_SourceNotRespectedForProjectStyle, nameof(Source), Project.ProjectStyle, NuGetProject.GetUniqueNameOrName(Project)); |
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.
nit:break the line?
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.
Unfortunately ProjectRestoreStyle isn't the reliable way to figure out format type so instead use NuGetProject instance type.
@@ -150,6 +153,19 @@ protected override void ProcessRecordCore() | |||
TelemetryService.EmitTelemetryEvent(actionTelemetryEvent); | |||
} | |||
|
|||
protected override void ValidateArgumentsAreSupported() |
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.
this isn't as much as validating as it is warning. i suggest change name to something like : WarnForPackageReferenceProject
f39b295
to
bb1403d
Compare
🔔 |
5d829e8
to
fca9172
Compare
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.
👍
Bug
Related: NuGet/Home#5763
Regression: No
If Regression then when did it last work:
If Regression then how are we preventing it in future:
Fix
Details:
Add a warning message when someone runs install -source, that it's not respected for PR projects.
Examples for install & update logs.
Testing/Validation
Tests Added: No
Reason for not adding tests:
Validation done: Manual