From 466eda64c5c6b90c3db958dfd4d83acf299645a0 Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Wed, 6 Sep 2017 12:26:08 -0700 Subject: [PATCH 1/2] Adding support for SxS DSC --- .../DscSupport/CimDSCParser.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 15deef3d1be..997a9862b89 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -663,7 +663,17 @@ public static void Initialize(Collection errors, List moduleP } else { - var systemResourceRoot = Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), "Configuration"); + // DSC SxS scenario + var psAssembly = Assembly.GetEntryAssembly(); + var configSystemPath = Path.GetDirectoryName(psAssembly.Location); + var systemResourceRoot = Path.Combine(configSystemPath, "Configuration"); + var inboxModulePath = "Modules\\PSDesiredStateConfiguration"; + if( !Directory.Exists(systemResourceRoot)) + { + configSystemPath = Platform.GetFolderPath(Environment.SpecialFolder.System); + systemResourceRoot = Path.Combine(configSystemPath, "Configuration"); + inboxModulePath = InboxDscResourceModulePath; + } var programFilesDirectory = Platform.GetFolderPath(Environment.SpecialFolder.ProgramFiles); Debug.Assert(programFilesDirectory != null, "Program Files environment variable does not exist!"); var customResourceRoot = Path.Combine(programFilesDirectory, "WindowsPowerShell\\Configuration"); From 0506760c04e787f8d365e36354e77dc9b2308324 Mon Sep 17 00:00:00 2001 From: Nitin Gupta Date: Wed, 6 Sep 2017 14:25:37 -0700 Subject: [PATCH 2/2] Fixing DSC SxS scenario for compilation --- src/System.Management.Automation/DscSupport/CimDSCParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 997a9862b89..2f590a8031d 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -714,7 +714,7 @@ public static void Initialize(Collection errors, List moduleP List modulePaths = new List(); if (modulePathList == null || modulePathList.Count == 0) { - modulePaths.Add(Path.Combine(Platform.GetFolderPath(Environment.SpecialFolder.System), InboxDscResourceModulePath)); + modulePaths.Add(Path.Combine(configSystemPath, inboxModulePath)); isInboxResource = true; } else