Skip to content

Latest commit

 

History

History
109 lines (71 loc) · 4.45 KB

File metadata and controls

109 lines (71 loc) · 4.45 KB

.NET Framework Docker Sample

This sample demonstrates how to use .NET Framework and Docker together.

The sample builds the application in a container based on the larger .NET Framework SDK Docker image.

This sample requires the Docker Desktop for Windows.

Try a pre-built .NET Framework Docker Image

You can quickly run a container with a pre-built .NET Framework Docker image.

Type the following Docker command:

docker run --rm mcr.microsoft.com/dotnet/framework/samples

Getting the sample

The easiest way to get the sample is by cloning the samples repository with git, using the following instructions.

git clone https://github.com/microsoft/dotnet-framework-docker/

You can also download the repository as a zip.

Build and run the sample with Docker

You can build and run the sample in Docker using the following commands. The instructions assume that you are in the root of the repository.

cd samples
cd dotnetapp
docker build --pull -t dotnetapp .
docker run --rm dotnetapp

Build and run the sample locally with the .NET SDK

You can build this .NET Framework 4.8 application locally with the .NET SDK using the following instructions. The instructions assume that you are in the root of the repository.

You must have the .NET Framework 4.8 targeting pack installed. It is easiest to install with Visual Studio and the the Visual Studio Installer.

cd samples
cd dotnetapp
dotnet run

You can produce an application that is ready to deploy to production using the following command:

dotnet publish -c Release -o out

You can run the published application using the following command.

out\dotnetapp.exe

Note: The -c Release argument builds the application in release mode (the default is debug mode). See the dotnet publish reference for more information on commandline parameters.

Build and run the sample locally with MSBuild

You can build this .NET Framework 4.8 application locally with MSBuild using the following instructions. The instructions assume that you are in the root of the repository and using the Developer Command Prompt for VS 2019.

You must have the .NET Framework 4.8 targeting pack installed. It is easiest to install with Visual Studio and the the Visual Studio Installer.

cd samples
cd dotnetapp
msbuild /t:restore
msbuild /p:Configuration=Release
dotnetapp\bin\Release\net48\dotnetapp.exe

Note: The /p:Configuration=Release argument builds the application in release mode (the default is debug mode). See the MSBuild Command-Line reference for more information on commandline parameters.

.NET Resources

More Samples

Docs and More Information:

Related Docker Hub Repos

.NET Framework:

.NET: