Skip to content

Commit 1b56cd8

Browse files
committed
Factor out reference assembly destination path
1 parent 644c3c4 commit 1b56cd8

File tree

10 files changed

+30
-20
lines changed

10 files changed

+30
-20
lines changed

eng/dockerfile-templates/sdk/Dockerfile.install-reference-assemblies

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
}}# Install Targeting Packs
1111
RUN powershell -Command "`
12-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
12+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
13+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
1314
foreach ($version in @@({{join(versions, ", ")}})) { `
1415
# Download reference assembly NuGet package `
1516
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -19,6 +20,6 @@ RUN powershell -Command "`
1920
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
2021
Where-Object { $_.FullName -match '@^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
2122
Remove-Item; `
22-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
23+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
2324
} `
2425
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"

src/sdk/3.5/windowsservercore-ltsc2016/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
117117

118118
# Install Targeting Packs
119119
RUN powershell -Command "`
120-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
120+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
121+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
121122
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
122123
# Download reference assembly NuGet package `
123124
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -127,7 +128,7 @@ RUN powershell -Command "`
127128
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
128129
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
129130
Remove-Item; `
130-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
131+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
131132
} `
132133
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"
133134

src/sdk/3.5/windowsservercore-ltsc2019/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
8787

8888
# Install Targeting Packs
8989
RUN powershell -Command "`
90-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
90+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
91+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
9192
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
9293
# Download reference assembly NuGet package `
9394
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -97,7 +98,7 @@ RUN powershell -Command "`
9798
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
9899
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
99100
Remove-Item; `
100-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
101+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
101102
} `
102103
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"
103104

src/sdk/3.5/windowsservercore-ltsc2022/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
6969

7070
# Install Targeting Packs
7171
RUN powershell -Command "`
72-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
72+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
73+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
7374
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
7475
# Download reference assembly NuGet package `
7576
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -79,6 +80,6 @@ RUN powershell -Command "`
7980
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
8081
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
8182
Remove-Item; `
82-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
83+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
8384
} `
8485
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"

src/sdk/3.5/windowsservercore-ltsc2025/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
6969

7070
# Install Targeting Packs
7171
RUN powershell -Command "`
72-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
72+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
73+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
7374
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
7475
# Download reference assembly NuGet package `
7576
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -79,6 +80,6 @@ RUN powershell -Command "`
7980
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
8081
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
8182
Remove-Item; `
82-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
83+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
8384
} `
8485
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"

src/sdk/4.8.1/windowsservercore-ltsc2022/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
6969

7070
# Install Targeting Packs
7171
RUN powershell -Command "`
72-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
72+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
73+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
7374
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
7475
# Download reference assembly NuGet package `
7576
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -79,6 +80,6 @@ RUN powershell -Command "`
7980
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
8081
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
8182
Remove-Item; `
82-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
83+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
8384
} `
8485
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"

src/sdk/4.8.1/windowsservercore-ltsc2025/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
6969

7070
# Install Targeting Packs
7171
RUN powershell -Command "`
72-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
72+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
73+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
7374
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
7475
# Download reference assembly NuGet package `
7576
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -79,6 +80,6 @@ RUN powershell -Command "`
7980
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
8081
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
8182
Remove-Item; `
82-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
83+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
8384
} `
8485
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"

src/sdk/4.8/windowsservercore-ltsc2016/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
8585

8686
# Install Targeting Packs
8787
RUN powershell -Command "`
88-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
88+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
89+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
8990
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
9091
# Download reference assembly NuGet package `
9192
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -95,7 +96,7 @@ RUN powershell -Command "`
9596
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
9697
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
9798
Remove-Item; `
98-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
99+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
99100
} `
100101
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"
101102

src/sdk/4.8/windowsservercore-ltsc2019/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
6868

6969
# Install Targeting Packs
7070
RUN powershell -Command "`
71-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
71+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
72+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
7273
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
7374
# Download reference assembly NuGet package `
7475
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -78,7 +79,7 @@ RUN powershell -Command "`
7879
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
7980
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
8081
Remove-Item; `
81-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
82+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
8283
} `
8384
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"
8485

src/sdk/4.8/windowsservercore-ltsc2022/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ RUN powershell setx /M PATH $(${Env:PATH} `
6969

7070
# Install Targeting Packs
7171
RUN powershell -Command "`
72-
New-Item -ItemType Directory -Path \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
72+
$referenceAssembliesPath = \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
73+
New-Item -ItemType Directory -Path ${referenceAssembliesPath}; `
7374
foreach ($version in @('net40', 'net45', 'net451', 'net452', 'net46', 'net461', 'net462', 'net47', 'net471', 'net472', 'net48', 'net481')) { `
7475
# Download reference assembly NuGet package `
7576
$package = \"Microsoft.NETFramework.ReferenceAssemblies.${version}\"; `
@@ -79,6 +80,6 @@ RUN powershell -Command "`
7980
Get-ChildItem -File -Recurse -Path \"${contents}\" | `
8081
Where-Object { $_.FullName -match '^(?!.*\\\\(PermissionSets|RedistList)\\\\).*\\.xml$' } | `
8182
Remove-Item; `
82-
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\"; `
83+
Copy-Item -Recurse -Force -Container -Path ${contents} -Destination ${referenceAssembliesPath}; `
8384
} `
8485
Remove-Item -Force -Recurse ${Env:TEMP}\\*;"

0 commit comments

Comments
 (0)