88#include " Public/ConfigurationSetProcessorFactoryRemoting.h"
99#include " ConfigurationCommon.h"
1010#include " ConfigurationWingetDscModuleUnitValidation.h"
11+ #include " Commands/DscCommandBase.h"
1112#include < AppInstallerDateTime.h>
1213#include < AppInstallerDownloader.h>
1314#include < AppInstallerErrors.h>
@@ -47,8 +48,9 @@ namespace AppInstaller::CLI::Workflow
4748 constexpr std::wstring_view s_Unit_WinGetPackage = L" WinGetPackage" ;
4849 constexpr std::wstring_view s_Unit_WinGetSource = L" WinGetSource" ;
4950
50- constexpr std::wstring_view s_UnitType_WinGetPackage_DSCv3 = L" Microsoft.WinGet/Package" ;
51- constexpr std::wstring_view s_UnitType_WinGetSource_DSCv3 = L" Microsoft.WinGet/Source" ;
51+ constexpr std::wstring_view s_UnitType_WinGetPackage_DSCv3 = WINGET_DSCV3_MODULE_NAME_WIDE L" /Package" ;
52+ constexpr std::wstring_view s_UnitType_WinGetSource_DSCv3 = WINGET_DSCV3_MODULE_NAME_WIDE L" /Source" ;
53+ constexpr std::wstring_view s_UnitType_WinGetUserSettingsFile_DSCv3 = WINGET_DSCV3_MODULE_NAME_WIDE L" /UserSettingsFile" ;
5254 constexpr std::wstring_view s_UnitType_PowerShellModuleGet = L" PowerShellGet/PSModule" ;
5355
5456 constexpr std::wstring_view s_Module_WinGetClient = L" Microsoft.WinGet.DSC" ;
@@ -66,19 +68,33 @@ namespace AppInstaller::CLI::Workflow
6668 struct PredefinedResource
6769 {
6870 // RequiredModule could be empty, meaning no required modules needed.
69- std::wstring RequiredModule;
71+ std::wstring_view RequiredModule;
7072
71- std::vector<std::wstring > UnitTypes;
73+ std::vector<std::wstring_view > UnitTypes;
7274 };
7375
74- static const PredefinedResource s_PredefinedResourcesForExport[] = {
75- { std::wstring{ s_Module_WinGetClient }, { L" Microsoft.WinGet.DSC/WinGetUserSettings" } },
76- { L" Microsoft.Windows.Developer" , { L" Microsoft.Windows.Developer/DeveloperMode" , L" Microsoft.Windows.Developer/EnableDarkMode" , L" Microsoft.Windows.Developer/ShowSecondsInClock" , L" Microsoft.Windows.Developer/Taskbar" , L" Microsoft.Windows.Developer/WindowsExplorer" }},
77- };
76+ std::vector<PredefinedResource> PredefinedResourcesForExport ()
77+ {
78+ return {
79+ { {}, { s_UnitType_WinGetUserSettingsFile_DSCv3 } },
80+ { L" Microsoft.Windows.Developer" , { L" Microsoft.Windows.Developer/DeveloperMode" , L" Microsoft.Windows.Developer/EnableDarkMode" , L" Microsoft.Windows.Developer/ShowSecondsInClock" , L" Microsoft.Windows.Developer/Taskbar" , L" Microsoft.Windows.Developer/WindowsExplorer" } },
81+ };
82+ }
7883
79- static const std::wstring s_PackageSettingsExclusionList[] = {
80- L" Microsoft.WinGet/" , L" Microsoft.DSC.Debug/" , L" Microsoft.DSC/" , L" Microsoft.DSC.Transitional/" , L" Microsoft.Windows/RebootPending" ,
81- L" Microsoft.Windows/Registry" , L" Microsoft.Windows/WMI" , L" Microsoft.Windows/WindowsPowerShell" , L" Microsoft/OSInfo"
84+ std::vector<std::wstring_view> PackageSettingsExclusionList ()
85+ {
86+ return {
87+ L" Microsoft.WinGet/" ,
88+ L" Microsoft.WinGet.Dev/" ,
89+ L" Microsoft.DSC.Debug/" ,
90+ L" Microsoft.DSC/" ,
91+ L" Microsoft.DSC.Transitional/" ,
92+ L" Microsoft.Windows/RebootPending" ,
93+ L" Microsoft.Windows/Registry" ,
94+ L" Microsoft.Windows/WMI" ,
95+ L" Microsoft.Windows/WindowsPowerShell" ,
96+ L" Microsoft/OSInfo"
97+ };
8298 };
8399
84100 Logging::Level ConvertLevel (DiagnosticLevel level)
@@ -1475,7 +1491,7 @@ namespace AppInstaller::CLI::Workflow
14751491 {
14761492 ConfigurationContext& configContext = context.Get <Data::ConfigurationContext>();
14771493
1478- for (const auto & resources : s_PredefinedResourcesForExport )
1494+ for (const auto & resources : PredefinedResourcesForExport () )
14791495 {
14801496 std::optional<ConfigurationUnit> requiredModuleUnit;
14811497
@@ -1538,11 +1554,13 @@ namespace AppInstaller::CLI::Workflow
15381554 context.Reporter .Warn () << Resource::String::ConfigurationExportFailedToGetUnitProcessors << std::endl;
15391555 }
15401556
1557+ auto exclusionList = PackageSettingsExclusionList ();
1558+
15411559 // Filter out processors in exclusion list.
15421560 for (auto itr = unitProcessors.begin (); itr != unitProcessors.end (); /* itr incremented in the logic */ )
15431561 {
15441562 bool processorRemoved = false ;
1545- for (const auto & exclusionItem : anon::s_PackageSettingsExclusionList )
1563+ for (const auto & exclusionItem : exclusionList )
15461564 {
15471565 if (Utility::CaseInsensitiveStartsWith (itr->UnitType (), exclusionItem))
15481566 {
0 commit comments