Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ GetRestAPIBaseUri\(".*"\) == L".*"
# Sample store product id for App Installer
9nblggh4nns1
9NVTPZWRC6KQ
9PCX3HX4HZ0Z

# Automatically suggested patterns

Expand Down
9 changes: 0 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,8 @@ jobs:
displayName: Clean up Sysinternals PsTools
condition: succeededOrFailed()

# Install DSC v3 until the DSC v3 processor handles that on its own
- powershell: |
$installResult = Install-WinGetPackage -Id Microsoft.DSC.Preview -Source winget -InstallerType Msix -Version 3.1.1
$installResult | Format-List
if ($installResult.ExtendedErrorCode) { throw $installResult.ExtendedErrorCode }
displayName: Install DSC v3
condition: succeededOrFailed()

# Install required DSC modules until export all command can handle auto acquisition
- pwsh: |
Install-Module -Name Microsoft.WinGet.DSC -Force
Install-Module -Name Microsoft.Windows.Developer -AllowPrerelease -Force
displayName: Install Required DSC Modules for Tests
condition: succeededOrFailed()
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationInDesiredState);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationInform);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationInitializing);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationInstallDscPackage);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationInstallDscPackageFailed);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationLocal);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationModuleNameOnly);
WINGET_DEFINE_RESOURCE_STRINGID(ConfigurationModulePath);
Expand Down
36 changes: 36 additions & 0 deletions src/AppInstallerCLICore/Workflows/ConfigurationFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ImportExportFlow.h"
#include "PromptFlow.h"
#include "TableOutput.h"
#include "MSStoreInstallerHandler.h"
#include "Public/ConfigurationSetProcessorFactoryRemoting.h"
#include "ConfigurationCommon.h"
#include "ConfigurationWingetDscModuleUnitValidation.h"
Expand Down Expand Up @@ -187,6 +188,41 @@ namespace AppInstaller::CLI::Workflow
{
factoryMap.Insert(ConfigurationRemoting::ToHString(ConfigurationRemoting::PropertyName::DscExecutablePath), Utility::ConvertToUTF16(context.Args.GetArg(Args::Type::ConfigurationProcessorPath)));
}
else
{
// Make sure DSC executable path can be found. Otherwise, we'll install the DSC v3 package.
winrt::hstring foundExecutablePath = factoryMap.Lookup(ConfigurationRemoting::ToHString(ConfigurationRemoting::PropertyName::FoundDscExecutablePath));
if (foundExecutablePath.empty())
{
AICLI_LOG(Config, Info, << "dsc.exe not found and not provided. Installing dsc package from store.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a user presentable message sent out as well.

context.Reporter.Info() << Resource::String::ConfigurationInstallDscPackage;

auto installDscContextPtr = context.CreateSubContext();
Execution::Context& installDscContext = *installDscContextPtr;
auto previousThreadGlobals = installDscContext.SetForCurrentThread();

Manifest::ManifestInstaller dscInstaller;
// TEMP: Until DSCv3 support is not experimental, allow the preview build to be installed automatically.
// #ifndef AICLI_DISABLE_TEST_HOOKS
dscInstaller.ProductId = "9PCX3HX4HZ0Z";
// #else
// dscInstaller.ProductId = "9NVTPZWRC6KQ";
// #endif
installDscContext.Add<Execution::Data::Installer>(std::move(dscInstaller));
installDscContext.Args.AddArg(Execution::Args::Type::InstallScope, Manifest::ScopeToString(Manifest::ScopeEnum::User));
installDscContext.Args.AddArg(Execution::Args::Type::Silent);
installDscContext.Args.AddArg(Execution::Args::Type::Force);

installDscContext << MSStoreInstall;

if (installDscContext.IsTerminated())
{
AICLI_LOG(Config, Error, << "Failed to install dsc v3 package and could not find dsc.exe, it must be provided by the user.");
context.Reporter.Error() << Resource::String::ConfigurationInstallDscPackageFailed;
THROW_WIN32(ERROR_FILE_NOT_FOUND);
}
}
}

if (Logging::Log().IsEnabled(Logging::Channel::Config, Logging::Level::Verbose))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3348,4 +3348,11 @@ Please specify one of them using the --source option to proceed.</value>
<data name="OutputDirectoryArgumentDescription" xml:space="preserve">
<value>Directory where the results are to be written</value>
</data>
</root>
<data name="ConfigurationInstallDscPackage" xml:space="preserve">
<value>Desired State Configuration package not found on the system. Installing the package...</value>
</data>
<data name="ConfigurationInstallDscPackageFailed" xml:space="preserve">
<value>Failed to install Desired State Configuration package. Install the package manually or provide the path to dsc.exe through --processor-path argument.</value>
<comment>{Locked="dsc.exe","--processor-path"}</comment>
</data>
</root>