Create the ASP.Net Framework Application

Open Visual Studio and click ‘File’ and ‘New Project’

Select the C# language and type in the filter. Select ‘ASP.NET Web Application (.NET Framework)’ and click ‘Next’ visual-studio-new-application

Specify Project and Solutions names as ‘ECS-ASPNET’, and click ‘Create’. visual-studio-new-project

Select the ‘MVC’ project template, make sure ‘Enable Docker support’ is checked. Then, click ‘Create’ visual-studio-new-asp

Examine the automatically-generated Dockerfile. It may look like this

ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .

Replace it with the following content

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see 
FROM AS base
ARG source

FROM AS build
COPY . .
RUN nuget restore -PackagesDirectory ../packages; msbuild /p:Configuration=Release /p:publishUrl=/out /p:DeleteExistingFiles=True /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem 

# copy build artifacts into runtime image
FROM base as final
WORKDIR /inetpub/wwwroot
COPY --from=build /out .

Next edit the .dockerignore file, removing the first line containing the ‘*’ character. The resulting file should look like the below.


Build and run the project to ensure it starts up without error. This make take some time as the base Docker images must be downloaded.