Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Running .NET 3.5 CF builds under Docker for Windows
# this is the GitLab-CI file for building the image
variables:
CURRENT_IMAGE_TAG: rfid-applied/netcf35_build_environment:dev
stages:
- dockerize
dockerize:
stage: dockerize
script:
- docker build -t %CURRENT_IMAGE_TAG% .
- docker push %CURRENT_IMAGE_TAG%
- docker rmi %CURRENT_IMAGE_TAG%
tags:
- my-windows-containers-machine
FROM microsoft/dotnet-framework-build:3.5
# .NET Compact Framework 3.5 Redistributable:
# https://www.microsoft.com/en-us/download/details.aspx?id=65
RUN powershell Invoke-WebRequest -Uri "https://download.microsoft.com/download/c/b/e/cbe1c611-7f2f-4bcf-921d-2df718591e1e/NETCFSetupv35.msi" -Out netfx35cf.msi
# we HAVE to install it like this, otherwise it won't wait for install
# to finish (UGH!)
RUN powershell "Start-Process -file "c:\netfx35cf.msi" -arg ' /qn /l*v c:\install_netfx35cf.txt' -passthru | wait-process"
RUN "cat c:\install_netfx35cf.txt"
RUN "del c:\*netfx35cf.*"
# Power Toys for .NET Compact Framework 3.5:
RUN powershell Invoke-WebRequest -Uri "https://download.microsoft.com/download/f/a/c/fac1342d-044d-4d88-ae97-d278ef697064/NETCFv35PowerToys.msi" -Out toys.msi
RUN powershell "Start-Process -file "c:\toys.msi" -arg ' /qn /l*v c:\install_toys.txt' -passthru | wait-process"
RUN "cat c:\install_toys.txt"
RUN "del c:\*toys.*"
# NuGet
ADD "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" "c:\nuget.exe"
@objt-ba

This comment has been minimized.

Copy link

@objt-ba objt-ba commented Aug 22, 2019

The following gave me an exception, "Invoke-WebRequest is not recognized ...".

RUN Invoke-WebRequest -Uri "https://download.microsoft.com/download/c/b/e/cbe1c611-7f2f-4bcf-921d-2df718591e1e/NETCFSetupv35.msi" -Out netfx35cf.msi`

But it works fine like:

RUN powershell Invoke-WebRequest -Uri "https://download.microsoft.com/download/c/b/e/cbe1c611-7f2f-4bcf-921d-2df718591e1e/NETCFSetupv35.msi" -Out netfx35cf.msi

The same applies for the Start-Process commands.

@ashalkhakov

This comment has been minimized.

Copy link
Owner Author

@ashalkhakov ashalkhakov commented Aug 22, 2019

Thank you @objt-ba, fixed it. It worked for me as-is, but that was more than a year ago.

@objt-ba

This comment has been minimized.

Copy link

@objt-ba objt-ba commented Aug 22, 2019

It's a great script ! :) So, thank you !

After more testing, also found that the piping with wait-process also needs it.
So, I wrapped the entire thing in quotes, as follows:

RUN powershell "Start-Process -file 'c:\netfx35cf.msi' -arg ' /qn /l*v c:\install_netfx35cf.txt' -passthru | wait-process"
...
RUN powershell "Start-Process -file 'c:\toys.msi' -arg ' /qn /l*v c:\install_toys.txt' -passthru | wait-process"

But that's all.

@ashalkhakov

This comment has been minimized.

Copy link
Owner Author

@ashalkhakov ashalkhakov commented Aug 22, 2019

Great, thank you for the input! Happy that you found it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment