Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into msstoredownload
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft committed May 9, 2024
2 parents 44cd0a8 + 4073c43 commit e3e17f0
Show file tree
Hide file tree
Showing 69 changed files with 2,127 additions and 581 deletions.
2 changes: 2 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ und
UNICODESTRING
uninstalling
Unmarshal
unskipped
untimes
updatefile
updatemanifest
Expand All @@ -377,6 +378,7 @@ wcsicmp
webpage
WHOLECHAIN
wil
windbg
wincrypt
WINEVENT
winget
Expand Down
5 changes: 4 additions & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ ECustom
EFGH
EFile
efileresource
EMalicious
endregion
ENDSESSION
EPester
Expand Down Expand Up @@ -158,6 +159,7 @@ GRPICONDIR
GRPICONDIRENTRY
guiddef
Hackathon
hashtables
helplib
helplibrary
hhx
Expand Down Expand Up @@ -214,6 +216,7 @@ JToken
JValue
Kaido
KNOWNFOLDERID
kool
ktf
ldcase
learnxinyminutes
Expand Down Expand Up @@ -293,7 +296,7 @@ NESTEDINSTALLER
netfx
netlify
NETSDK
Newtonsoft
Newtonsoft
nlohmann
NNS
NOAGGREGATION
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,6 @@ src/PowerShell/Microsoft.WinGet.Client/Crescendo/*.psm1

# Dev PowerShell module path
src/PowerShell/scripts/Module

# Interop nuget
src/WinGetUtilInterop/scripts/Nuget*
1 change: 1 addition & 0 deletions .vsconfig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.Vcpkg",
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
"Microsoft.VisualStudio.Component.Windows11SDK.22000",
"Microsoft.VisualStudio.Workload.NativeDesktop",
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

If you are new to the Windows Package Manager, you might want to [Explore the Windows Package Manager tool](https://docs.microsoft.com/learn/modules/explore-windows-package-manager-tool/?WT.mc_id=AZ-MVP-5004737). The client has access to packages from two default sources. The first is "msstore" the Microsoft Store (free Apps rated "e" for everyone). The second is "winget" the [WinGet community repository](https://github.com/microsoft/winget-pkgs).

> **Note**: Group policy may be configured and modify configured sources. Run `winget --info` to see any configured policies.
> [!NOTE]
> Group policy may be configured and modify configured sources. Run `winget --info` to see any configured policies.
## Installing The Client

> **Note**: The client requires Windows 10 1809 (build 17763) or later at this time. Windows Server 2019 is not supported as the Microsoft Store is not available nor are updated dependencies. It may be possible to install on Windows Server 2022, this should be considered experimental (not supported), and requires dependencies to be manually installed as well.
> [!NOTE]
> The client requires Windows 10 1809 (build 17763) or later at this time. Windows Server 2019 is not supported as the Microsoft Store is not available nor are updated dependencies. It may be possible to install on Windows Server 2022, this should be considered experimental (not supported), and requires dependencies to be manually installed as well.
### Microsoft Store [Recommended]

Expand All @@ -24,15 +26,17 @@ There are two methods to get development releases:
* Install a [Windows 10 or Windows 11 Insider](https://insider.windows.com/) build.
* Join the Windows Package Manager Insider program by [signing up](http://aka.ms/winget-InsiderProgram).

> **Note**: It may take a few days to get the updated App Installer after you receive e-mail confirmation from joining the Windows Package Manager Insider program. If you decide to install the latest release from GitHub, and you have successfully joined the insider program, you will receive updates when the next development release has been published in the Microsoft Store.
> [!NOTE]
> It may take a few days to get the updated App Installer after you receive e-mail confirmation from joining the Windows Package Manager Insider program. If you decide to install the latest release from GitHub, and you have successfully joined the insider program, you will receive updates when the next development release has been published in the Microsoft Store.
Once you have received the updated App Installer from the Microsoft Store you should be able to execute `winget features` to see experimental features. Some users have reported [issues](https://github.com/microsoft/winget-cli/issues/210) with the client not being on their PATH.

### Manually Update

The same Microsoft Store package will be made available via our [Releases](https://github.com/microsoft/winget-cli/releases). Note that installing this package will give you the WinGet client, but it will not enable automatic updates from the Microsoft Store if you have not joined the Windows Package Manager Insider program.

> **Note**: You may need to install the [VC++ v14 Desktop Framework Package](https://docs.microsoft.com/troubleshoot/cpp/c-runtime-packages-desktop-bridge#how-to-install-and-update-desktop-framework-packages).
> [!NOTE]
> You may need to install the [VC++ v14 Desktop Framework Package](https://docs.microsoft.com/troubleshoot/cpp/c-runtime-packages-desktop-bridge#how-to-install-and-update-desktop-framework-packages).
> This should only be necessary on older builds of Windows 10 and only if you get an error about missing framework packages.
### Troubleshooting
Expand Down Expand Up @@ -84,7 +88,8 @@ The client is built around the concept of sources; a set of packages effectively
1. Clone the repository
2. Configure your system, please use the [configuration file](.configurations/configuration.dsc.yaml). This can be applied by either:
* [Dev Home](https://github.com/microsoft/devhome)'s machine configuration tool
* WinGet configuration. If you have the experimental feature enabled, run `winget configure .configurations/configuration.dsc.yaml` from the project root so relative paths resolve correctly
* WinGet configuration. Run `winget configure .configurations/configuration.dsc.yaml` from the project root so relative paths resolve correctly
3. Run `vcpkg integrate install` from Developer Command Prompt for VS 2022. This is one time setup step until configuration file in step 2 is updated to work with vcpkg setup.

### Prerequisites

Expand All @@ -96,8 +101,10 @@ The client is built around the concept of sources; a set of packages effectively
* .NET Desktop Development
* Desktop Development with C++
* Universal Windows Platform Development
* Check [.vsconfig file](.vsconfig) for full components list
* [Windows SDK for Windows 11 (10.0.22000.194)](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/)
> **Note**: You can also get it through `winget install Microsoft.WindowsSDK --version 10.0.22000.832` (use --force if you have a newer version installed) or via Visual Studio > Get Tools and Features > Individual Components > Windows 10 SDK (10.0.22000.0)
> [!NOTE]
> You can also get it through `winget install Microsoft.WindowsSDK --version 10.0.22000.832` (use --force if you have a newer version installed) or via Visual Studio > Get Tools and Features > Individual Components > Windows 10 SDK (10.0.22000.0)
* The following extensions:
* [Microsoft Visual Studio Installer Projects](https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2022InstallerProjects)

Expand Down
17 changes: 14 additions & 3 deletions doc/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,26 @@ Currently, this means that properly attributed configuration units (and only tho
"experimentalFeatures": {
"configureSelfElevate": true
},
```

```

### storeDownload

This feature enables packages to be downloaded from the Microsoft Store.
This feature enables packages to be downloaded from the Microsoft Store.
You can enable the feature as shown below.

```json
"experimentalFeatures": {
"storeDownload": true
},
```

### configureExport

This feature enables exporting a configuration file.
You can enable the feature as shown below.

```json
"experimentalFeatures": {
"configureExport": true
},
```
4 changes: 4 additions & 0 deletions doc/windows/package-manager/winget/returnCodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ Installation failed. Restart your PC then try again. |
| 0x8A15C00C | -1978286068 | WINGET_CONFIG_ERROR_SET_DEPENDENCY_CYCLE | The dependency graph contains a cycle which cannot be resolved. |
| 0x8A15C00D | -1978286067 | WINGET_CONFIG_ERROR_INVALID_FIELD_VALUE | The configuration has an invalid field value. |
| 0x8A15C00E | -1978286066 | WINGET_CONFIG_ERROR_MISSING_FIELD | The configuration is missing a field. |
| 0x8A15C00F | -1978286065 | WINGET_CONFIG_ERROR_TEST_FAILED | Some of the configuration units failed while testing their state. |
| 0x8A15C010 | -1978286064 | WINGET_CONFIG_ERROR_TEST_NOT_RUN | Configuration state was not tested. |
| 0x8A15C011 | -1978286063 | WINGET_CONFIG_ERROR_GET_FAILED | The configuration unit failed getting its properties. |

## Configuration Processor Errors

Expand All @@ -216,3 +219,4 @@ Installation failed. Restart your PC then try again. |
| 0x8A15C109 | -1978285815 | WINGET_CONFIG_ERROR_UNIT_INVOKE_INVALID_RESULT | The configuration unit returned an unexpected result during execution. |
| 0x8A15C110 | -1978285814 | WINGET_CONFIG_ERROR_UNIT_SETTING_CONFIG_ROOT | A unit contains a setting that requires the config root. |
| 0x8A15C111 | -1978285813 | WINGET_CONFIG_ERROR_UNIT_IMPORT_MODULE_ADMIN | Loading the module for the configuration unit failed because it requires administrator privileges to run. |
| 0x8A15C112 | -1978285812 | WINGET_CONFIG_ERROR_NOT_SUPPORTED_BY_PROCESSOR | Operation is not supported by the configuration processor. |
5 changes: 5 additions & 0 deletions schemas/JSON/settings/settings.schema.0.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@
"description": "Enable support for downloading packages from the Microsoft Store",
"type": "boolean",
"default": false
},
"configureExport": {
"description": "Enable support for the configure export command",
"type": "boolean",
"default": false
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/AppInstallerCLICore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
<ClInclude Include="ConfigurationCommon.h" />
<ClInclude Include="ConfigurationContext.h" />
<ClInclude Include="ConfigurationWingetDscModuleUnitValidation.h" />
<ClInclude Include="ConfigureExportCommand.h" />
<ClInclude Include="ContextOrchestrator.h" />
<ClInclude Include="COMContext.h" />
<ClInclude Include="Public\ConfigurationSetProcessorFactoryRemoting.h" />
Expand Down Expand Up @@ -446,6 +447,7 @@
<ClCompile Include="ConfigurationDynamicRuntimeFactory.cpp" />
<ClCompile Include="ConfigurationSetProcessorFactoryRemoting.cpp" />
<ClCompile Include="ConfigurationWingetDscModuleUnitValidation.cpp" />
<ClCompile Include="ConfigureExportCommand.cpp" />
<ClCompile Include="ContextOrchestrator.cpp" />
<ClCompile Include="Workflows\ConfigurationFlow.cpp" />
<ClCompile Include="Workflows\DependenciesFlow.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions src/AppInstallerCLICore/AppInstallerCLICore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
<ClInclude Include="ConfigurationWingetDscModuleUnitValidation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConfigureExportCommand.h">
<Filter>Commands</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
Expand Down Expand Up @@ -472,6 +475,9 @@
<ClCompile Include="ConfigurationDynamicRuntimeFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConfigureExportCommand.cpp">
<Filter>Commands</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="PropertySheet.props" />
Expand Down
10 changes: 8 additions & 2 deletions src/AppInstallerCLICore/Argument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ namespace AppInstaller::CLI
return { type, "position"_liv };

// Export Command
case Execution::Args::Type::OutputFile:
return { type, "output"_liv, 'o' };
case Execution::Args::Type::IncludeVersions:
return { type, "include-versions"_liv };

Expand Down Expand Up @@ -211,6 +209,12 @@ namespace AppInstaller::CLI
return { type, "disable"_liv, ArgTypeCategory::None, ArgTypeExclusiveSet::StubType };
case Execution::Args::Type::ConfigurationModulePath:
return { type, "module-path"_liv };
case Execution::Args::Type::ConfigurationExportPackageId:
return { type, "package-id"_liv };
case Execution::Args::Type::ConfigurationExportModule:
return { type, "module"_liv };
case Execution::Args::Type::ConfigurationExportResource:
return { type, "resource"_liv };

// Download command
case Execution::Args::Type::DownloadDirectory:
Expand Down Expand Up @@ -241,6 +245,8 @@ namespace AppInstaller::CLI
return { type, "open-logs"_liv, "logs"_liv };
case Execution::Args::Type::Force:
return { type, "force"_liv, ArgTypeCategory::CopyFlagToSubContext };
case Execution::Args::Type::OutputFile:
return { type, "output"_liv, 'o' };

case Execution::Args::Type::DependencySource:
return { type, "dependency-source"_liv, ArgTypeCategory::ExtendedSource };
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ namespace AppInstaller::CLI
Command(name, {}, parent, Command::Visibility::Show, Settings::ExperimentalFeature::Feature::None, Settings::TogglePolicy::Policy::None, outputFlags) {}
Command(std::string_view name, std::vector<std::string_view> aliases, std::string_view parent, Command::Visibility visibility) :
Command(name, aliases, parent, visibility, Settings::ExperimentalFeature::Feature::None) {}
Command(std::string_view name, std::string_view parent, Settings::ExperimentalFeature::Feature feature) :
Command(name, {}, parent, Command::Visibility::Show, feature) {}
Command(std::string_view name, std::vector<std::string_view> aliases, std::string_view parent, Settings::ExperimentalFeature::Feature feature) :
Command(name, aliases, parent, Command::Visibility::Show, feature) {}
Command(std::string_view name, std::vector<std::string_view> aliases, std::string_view parent, Settings::TogglePolicy::Policy groupPolicy) :
Expand Down
3 changes: 2 additions & 1 deletion src/AppInstallerCLICore/Commands/ConfigureCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ConfigureShowCommand.h"
#include "ConfigureTestCommand.h"
#include "ConfigureValidateCommand.h"
#include "ConfigureExportCommand.h"
#include "Workflows/ConfigurationFlow.h"
#include "Workflows/MSStoreInstallerHandler.h"
#include "ConfigurationCommon.h"
Expand All @@ -25,6 +26,7 @@ namespace AppInstaller::CLI
std::make_unique<ConfigureShowCommand>(FullName()),
std::make_unique<ConfigureTestCommand>(FullName()),
std::make_unique<ConfigureValidateCommand>(FullName()),
std::make_unique<ConfigureExportCommand>(FullName()),
});
}

Expand All @@ -51,7 +53,6 @@ namespace AppInstaller::CLI

Utility::LocIndView ConfigureCommand::HelpLink() const
{
// TODO: Make this exist
return "https://aka.ms/winget-command-configure"_liv;
}

Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Commands/ConfigureShowCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ namespace AppInstaller::CLI

Utility::LocIndView ConfigureShowCommand::HelpLink() const
{
// TODO: Make this exist
return "https://aka.ms/winget-command-configure#show"_liv;
}

void ConfigureShowCommand::ExecuteInternal(Execution::Context& context) const
{
context <<
VerifyIsFullPackage <<
VerifyFileOrUri(Execution::Args::Type::ConfigurationFile) <<
CreateConfigurationProcessor <<
OpenConfigurationSet <<
Expand Down
1 change: 0 additions & 1 deletion src/AppInstallerCLICore/Commands/ConfigureTestCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace AppInstaller::CLI

Utility::LocIndView ConfigureTestCommand::HelpLink() const
{
// TODO: Make this exist
return "https://aka.ms/winget-command-configure#test"_liv;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ namespace AppInstaller::CLI

Utility::LocIndView ConfigureValidateCommand::HelpLink() const
{
// TODO: Make this exist
return "https://aka.ms/winget-command-configure#validate"_liv;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace AppInstaller::CLI::ConfigurationRemoting
// Support for 0.2 schema via metadata value
// TODO: Support case insensitive lookup by iteration
auto unitMetadata = unit.Metadata();
auto securityContext = unitMetadata.TryLookup(L"SecurityContext");
auto securityContext = unitMetadata.TryLookup(L"securityContext");
if (securityContext)
{
auto securityContextProperty = securityContext.try_as<IPropertyValue>();
Expand Down
64 changes: 64 additions & 0 deletions src/AppInstallerCLICore/ConfigureExportCommand.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"
#include "ConfigureExportCommand.h"
#include "Workflows/ConfigurationFlow.h"
#include "ConfigurationCommon.h"

using namespace AppInstaller::CLI::Workflow;

namespace AppInstaller::CLI
{
std::vector<Argument> ConfigureExportCommand::GetArguments() const
{
return {
Argument{ Execution::Args::Type::OutputFile, Resource::String::OutputFileArgumentDescription, true },
Argument{ Execution::Args::Type::ConfigurationExportPackageId, Resource::String::ConfigureExportPackageId },
Argument{ Execution::Args::Type::ConfigurationExportModule, Resource::String::ConfigureExportModule },
Argument{ Execution::Args::Type::ConfigurationExportResource, Resource::String::ConfigureExportResource },
Argument{ Execution::Args::Type::ConfigurationModulePath, Resource::String::ConfigurationModulePath },
};
}

Resource::LocString ConfigureExportCommand::ShortDescription() const
{
return { Resource::String::ConfigureExportCommandShortDescription };
}

Resource::LocString ConfigureExportCommand::LongDescription() const
{
return { Resource::String::ConfigureExportCommandLongDescription };
}

Utility::LocIndView ConfigureExportCommand::HelpLink() const
{
return "https://aka.ms/winget-command-configure#export"_liv;
}

void ConfigureExportCommand::ExecuteInternal(Execution::Context& context) const
{
context <<
VerifyIsFullPackage <<
CreateConfigurationProcessor <<
CreateOrOpenConfigurationSet <<
AddWinGetPackageAndResource <<
WriteConfigFile;
}

void ConfigureExportCommand::ValidateArgumentsInternal(Execution::Args& execArgs) const
{
Configuration::ValidateCommonArguments(execArgs);

bool validInputArgs = false;
if (execArgs.Contains(Execution::Args::Type::ConfigurationExportModule, Execution::Args::Type::ConfigurationExportResource) ||
execArgs.Contains(Execution::Args::Type::ConfigurationExportPackageId))
{
validInputArgs = true;
}

if (!validInputArgs)
{
throw CommandException(Resource::String::ConfigureExportArgumentError);
}
}
}

0 comments on commit e3e17f0

Please sign in to comment.