@@ -130,7 +130,6 @@ function Convert-ADTDeployment
130130 $variableReplacements = @ (' appVendor' , ' appName' , ' appVersion' , ' appArch' , ' appLang' , ' appRevision' , ' appScriptVersion' , ' appScriptAuthor' , ' installName' , ' installTitle' )
131131
132132 $customRulePath = [System.IO.Path ]::Combine($MyInvocation.MyCommand.Module.ModuleBase , ' PSScriptAnalyzer\Measure-ADTCompatibility.psm1' )
133- $templateScriptPath = [System.IO.Path ]::Combine((Get-Module PSAppDeployToolkit).ModuleBase, ' Frontend\v4\Invoke-AppDeployToolkit.ps1' )
134133 }
135134
136135 process
@@ -140,6 +139,7 @@ function Convert-ADTDeployment
140139 try
141140 {
142141 $Path = (Resolve-Path - LiteralPath $Path ).Path
142+ $Destination = (Resolve-Path - LiteralPath $Destination ).Path
143143 $tempFolderName = " Convert-ADTDeployment_$ ( [System.IO.Path ]::GetRandomFileName().Replace(' .' , ' ' )) "
144144 $tempFolderPath = [System.IO.Path ]::Combine([System.IO.Path ]::GetTempPath(), $tempFolderName )
145145
@@ -170,8 +170,8 @@ function Convert-ADTDeployment
170170 }
171171
172172 # Create the temp folder
173- Write-Verbose - Message " Creating temp folder [$tempFolderPath ]"
174- New-Item - Path $tempFolderPath - ItemType Directory - Force | Out-Null
173+ Write-Verbose - Message " Creating ADT Template in [$tempFolderPath ]"
174+ New-ADTTemplate - Destination ([ System.IO. Path]::GetTempPath()) - Name $tempFolderName
175175
176176 # Create a temp copy of the script to run ScriptAnalyzer fixes on - prefix filename with _ if it's named Invoke-AppDeployToolkit.ps1
177177 $inputScriptPath = if ($Path -match ' (?<=^|\\)Invoke-AppDeployToolkit.ps1$' )
@@ -185,10 +185,6 @@ function Convert-ADTDeployment
185185
186186 Write-Verbose - Message " Creating copy of [$Path ] as [$inputScriptPath ]"
187187 Copy-Item - LiteralPath $Path - Destination $inputScriptPath - Force
188-
189- # Copy over our template v4 script
190- Write-Verbose - Message " Copying template script to [$tempFolderPath \Invoke-AppDeployToolkit.ps1]"
191- $outputScriptPath = (Copy-Item - LiteralPath $templateScriptPath - Destination $tempFolderPath - Force - PassThru).FullName
192188 }
193189 else
194190 {
@@ -226,11 +222,11 @@ function Convert-ADTDeployment
226222
227223 Write-Verbose - Message " Creating copy of [$Path \Deploy-Application.ps1] as [$tempFolderPath \Deploy-Application.ps1]"
228224 $inputScriptPath = (Copy-Item - LiteralPath ([System.IO.Path ]::Combine($Path , ' Deploy-Application.ps1' )) - Destination $tempFolderPath - Force - PassThru).FullName
229-
230- # Set the path of our v4 template script
231- $outputScriptPath = [System.IO.Path ]::Combine($tempFolderPath , ' Invoke-AppDeployToolkit.ps1' )
232225 }
233226
227+ # Set the path of our v4 template script
228+ $outputScriptPath = [System.IO.Path ]::Combine($tempFolderPath , ' Invoke-AppDeployToolkit.ps1' )
229+
234230 # First run the fixes on the input script to update function names and variables
235231 Write-Verbose - Message " Running ScriptAnalyzer fixes on [$inputScriptPath ]"
236232 Invoke-ScriptAnalyzer - Path $inputScriptPath - CustomRulePath $customRulePath - Fix | Out-Null
0 commit comments