-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Implement PowerShell cmdlets #2838
Conversation
This comment has been minimized.
This comment has been minimized.
src/PowerShell/Microsoft.WinGet.Client/Commands/RepairCommand.cs
Outdated
Show resolved
Hide resolved
src/PowerShell/Microsoft.WinGet.Client/Common/WinGetIntegrity.cs
Outdated
Show resolved
Hide resolved
src/PowerShell/Microsoft.WinGet.Client/Helpers/AppxModuleHelper.cs
Outdated
Show resolved
Hide resolved
private void InstallUiXaml() | ||
{ | ||
// TODO: We need to follow up for Microsoft.UI.Xaml.2.7 | ||
// downloading the nuget and extracting it doesn't sound like the right thing to do. |
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 UI.Xaml package is one of the bigger sticking points for installing winget on devices that don't have access to the store. I think that even though it isn't the proper long-term approach, using the workaround through nuget temporarily would provide a better user experience
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 that we should implement that before fully releasing this, but I don't think it should necessarily block this PR.
src/PowerShell/Microsoft.WinGet.Client/Helpers/WinGetVersionHelper.cs
Outdated
Show resolved
Hide resolved
toInstallVersion = gitHubRelease.GetLatestVersionTagName(preRelease); | ||
} | ||
|
||
if (toInstallVersion != WinGetVersionHelper.InstalledWinGetVersion) |
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 would love to see implied wildcarding for version matching. For example - If the user specified -Version 1.3
or -Version 1.3.2
it would map to the version tag 1.3.2691. But if they used -Version 1.3.1
it would map to the version tag 1.3.1872 and require the -Prerelease
switch. Whereas -Version 1.3.20
would map to 1.3.2091.
This follows the idea that the cli version is often referenced as the "1.3 Client" or the "1.4 Client", so it's very common to only use the prefix of the version number.
(Yes, I know, I'm asking for scope creep here; Sorry @denelon)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
At a minimum the ARM64 change and the string change are needed. If we could do the UI XAML code easily, then I suspect you would have done it. But maybe you didn't investigate how difficult it would be to implement?
private void InstallUiXaml() | ||
{ | ||
// TODO: We need to follow up for Microsoft.UI.Xaml.2.7 | ||
// downloading the nuget and extracting it doesn't sound like the right thing to do. |
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 that we should implement that before fully releasing this, but I don't think it should necessarily block this PR.
src/PowerShell/Microsoft.WinGet.Client/Helpers/WinGetVersionHelper.cs
Outdated
Show resolved
Hide resolved
src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx
Outdated
Show resolved
Hide resolved
Co-authored-by: JohnMcPMS <[email protected]>
…ersion in resource
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This PR implements two new PowerShelll cmdlets
Assert-WinGetPackageManager
andRepair-WinGetPackageManager
as well as the WinGetPackageManager DSC Resource.Assert-WinGetPackageManager
verifies the integrity of winget for the current user. If winget is not set up correctly, it will throw an exception with the type of failure if detected.It can detect:
winget --version
.Assert-WinGetPackageManager -Version foo
also verifies the installed version is the same as the expected.Assert-WinGetPackageManager -Latest
also verifies the installed version is the latest release version.Assert-WinGetPackageManager -Latest -IncludePrerelease
also verifies the installed version is the latest prerelease version.Repair-WinGetPackageManager
does the same asAssert-WinGetIntegrity
but attempts to fix winget depending on the failure. Returns 0 is succeeded.Repair-WinGetPackageManager
repairs current winget installed and performs no updates. If winget is not installed or there's catastrophic failure then installs the latest released winget.Repair-WinGetPackageManager -Version foo
repairs winget and makes sure that the current installed version is the expected one.Repair-WinGetPackageManager -Latest
repairs winget and makes sure winget is the latest released version.Repair-WinGetPackageManager -Latest -IncludePreRelease
repairs winget and makes sure winget is the latest prereleased version.It sadly can't repair if AppExecution alias is disabled because there's no programmatic way to do it (requires internal APIs).
It also doesn't install Microsoft.UI.Xaml.2.7 as a dependency because the current solution to download the nuget package, extract it and install the appx within is not the right approach we want to follow. We will follow up internally with the owners of the package to do something similar as the VCLibs packages.
There's still a lot of opportunity for
Repair-WinGetPackageManager
to make it more robust, but this PR is just the starting phase.The
WinGetPackageManager
DSC resource is just a simple wrapper around those two cmdlets. There's also a sample on how to use it.For now, all versions need to be the tag name of the releases in GitHub.
Also, moved Get-WinGetVersion from Crescendo to a binary cmdlet.
Microsoft Reviewers: Open in CodeFlow