Skip to content
Permalink
3aee457527
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
78 lines (69 sloc) 4.35 KB
# escape=`
ARG REPO=mcr.microsoft.com/dotnet/framework/runtime
FROM $REPO:4.8-windowsservercore-2004
# Install NuGet CLI
ENV NUGET_VERSION 5.5.1
RUN mkdir "%ProgramFiles%\NuGet" `
&& curl -fSLo "%ProgramFiles%\NuGet\nuget.exe" https://dist.nuget.org/win-x86-commandline/v%NUGET_VERSION%/nuget.exe
# Install VS components
RUN `
# Install VS Test Agent
curl -fSLo vs_TestAgent.exe https://download.visualstudio.microsoft.com/download/pr/584a5fcf-dd07-4c36-add9-620e858c9a35/cd90750df4950dc9a6130937f4aaf7367f42944dea5fde2c78dbcb4bd8a7fa73/vs_TestAgent.exe `
&& start /w vs_TestAgent.exe --quiet --norestart --nocache --wait `
&& powershell -Command "if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { throw $err }" `
&& del vs_TestAgent.exe `
`
# Install VS Build Tools
&& curl -fSLo vs_BuildTools.exe https://download.visualstudio.microsoft.com/download/pr/584a5fcf-dd07-4c36-add9-620e858c9a35/536a649978a0c34a78ca99a0c7b14a7b52e96b5a563d86efe6fdf9559b2886fb/vs_BuildTools.exe `
# Installer won't detect DOTNET_SKIP_FIRST_TIME_EXPERIENCE if ENV is used, must use setx /M
&& setx /M DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1 `
&& start /w vs_BuildTools.exe ^ `
--add Microsoft.VisualStudio.Workload.MSBuildTools ^ `
--add Microsoft.VisualStudio.Workload.NetCoreBuildTools ^ `
--add Microsoft.Net.Component.4.8.SDK ^ `
--add Microsoft.Component.ClickOnce.MSBuild ^ `
--add Microsoft.VisualStudio.Component.WebDeploy ^ `
--quiet --norestart --nocache --wait `
&& powershell -Command "if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { throw $err }" `
&& del vs_BuildTools.exe `
`
# Cleanup
&& rmdir /S /Q "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer" `
&& powershell Remove-Item -Force -Recurse "%TEMP%\*" `
&& rmdir /S /Q "%ProgramData%\Package Cache"
# Install web targets
RUN curl -fSLo MSBuild.Microsoft.VisualStudio.Web.targets.zip https://dotnetbinaries.blob.core.windows.net/dockerassets/MSBuild.Microsoft.VisualStudio.Web.targets.2020.05.zip `
&& tar -zxf MSBuild.Microsoft.VisualStudio.Web.targets.zip -C "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VisualStudio\v16.0" `
&& del MSBuild.Microsoft.VisualStudio.Web.targets.zip
ENV DOTNET_USE_POLLING_FILE_WATCHER=true `
ROSLYN_COMPILER_LOCATION="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn" `
# Ngen workaround: https://github.com/microsoft/dotnet-framework-docker/issues/231
COMPLUS_NGenProtectedProcess_FeatureEnabled=0
# ngen assemblies queued by VS installers - must be done in cmd shell to avoid access issues
RUN `
# Workaround for issues with 64-bit ngen
\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen uninstall "%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\SecAnnotate.exe" `
&& \Windows\Microsoft.NET\Framework64\v4.0.30319\ngen uninstall "%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\WinMDExp.exe" `
`
&& \Windows\Microsoft.NET\Framework64\v4.0.30319\ngen update
# Set PATH in one layer to keep image size down.
RUN powershell setx /M PATH $(${Env:PATH} `
+ \";${Env:ProgramFiles}\NuGet\" `
+ \";${Env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow\" `
+ \";${Env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\" `
+ \";${Env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\" `
+ \";${Env:ProgramFiles(x86)}\Microsoft SDKs\ClickOnce\SignTool\")
# Install Targeting Packs
RUN powershell " `
$ErrorActionPreference = 'Stop'; `
$ProgressPreference = 'SilentlyContinue'; `
@('4.0', '4.5.2', '4.6.2', '4.7.2', '4.8') `
| %{ `
Invoke-WebRequest `
-UseBasicParsing `
-Uri https://dotnetbinaries.blob.core.windows.net/referenceassemblies/v${_}.zip `
-OutFile referenceassemblies.zip; `
Expand-Archive referenceassemblies.zip -DestinationPath \"${Env:ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\"; `
Remove-Item -Force referenceassemblies.zip; `
}"
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]