@@ -262,6 +262,12 @@ private string CreateConfigurationArchive()
262
262
null ) ) ;
263
263
}
264
264
List < string > requiredModules = parseResult . RequiredModules ;
265
+ //Since LCM always uses the latest module there is no need to copy PSDesiredStateConfiguration
266
+ if ( requiredModules . Contains ( "PSDesiredStateConfiguration" ) )
267
+ {
268
+ requiredModules . Remove ( "PSDesiredStateConfiguration" ) ;
269
+ }
270
+
265
271
WriteVerbose ( String . Format ( CultureInfo . CurrentUICulture , Resources . PublishVMDscExtensionRequiredModulesVerbose , String . Join ( ", " , requiredModules ) ) ) ;
266
272
267
273
// Create a temporary directory for uploaded zip file
@@ -290,8 +296,8 @@ private string CreateConfigurationArchive()
290
296
@"function Copy-Module([string]$module, [string]$tempZipFolder)
291
297
{
292
298
$mi = Get-Module -List -Name $module;
293
- $moduleFolder = Split-Path -Parent $mi.Path;
294
- Copy-Item -Recurse -Path $moduleFolder -Destination $tempZipFolder;
299
+ $moduleFolder = Split-Path $mi.Path;
300
+ Copy-Item -Recurse -Path $moduleFolder -Destination "" $tempZipFolder\$($mi.Name)""
295
301
}"
296
302
) ;
297
303
powershell . Invoke ( ) ;
@@ -329,7 +335,11 @@ private string CreateConfigurationArchive()
329
335
}
330
336
else
331
337
{
332
- archive = Path . Combine ( Path . GetTempPath ( ) , configurationName + ZipFileExtension ) ;
338
+ string tempArchiveFolder = Path . Combine ( Path . GetTempPath ( ) , Guid . NewGuid ( ) . ToString ( ) ) ;
339
+ WriteVerbose ( String . Format ( CultureInfo . CurrentUICulture , Resources . PublishVMDscExtensionTempFolderVerbose , tempArchiveFolder ) ) ;
340
+ Directory . CreateDirectory ( tempArchiveFolder ) ;
341
+ this . _temporaryDirectoriesToDelete . Add ( tempArchiveFolder ) ;
342
+ archive = Path . Combine ( tempArchiveFolder , configurationName + ZipFileExtension ) ;
333
343
this . _temporaryFilesToDelete . Add ( archive ) ;
334
344
}
335
345
0 commit comments