We are attempting to build a .NET core 3.1 app within a container, using dotnet publish
, dotnet build
or dotnet msbuild
commands, with different parameters. Which succeeds, but the problem is that EXE output never shows any file Details (Copyright, File version, etc. are empty), while DLLs do contain specified information. We've tried several different containers, as well as researching online and trying different command parameters, for versioning (there are a few). Also, running identical dotnet publish command on my Windows 10 machine directly, works as expected, no issues.
I've also attempted separating dotnet build
and dotnet publish
(--no-build
) commands and copying a code signed EXE in-between, in case there is a trust issue, but nothing worked.
Dockerfile content (also used dotnet publish
instead of msbuild
):
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine3.11
ARG Version="5.6.7"
WORKDIR /build
COPY ./src $WORKDIR
RUN dotnet restore
RUN echo $Version
RUN dotnet msbuild abc.csproj /t:Build /p:PublishSingleFile=True /p:SelfContained=True /p:PublishProtocol=FileSystem /p:Configuration=Release /p:Platform=x64 /p:TargetFrameworks=netcoreapp3.1 /p:PublishDir=publish /p:RuntimeIdentifier=win-x64 /p:PublishReadyToRun=False /p:PublishTrimmed=False /p:VersionNumber=$Version /p:VersionPrefix=$Version /p:Version=$Version /p:AssemblyVersion=$Version /p:AssemblyVersionAttribute=$Version /p:FileVersion=$Version /p:AssemblyFileVersionAttribute=$Version
Steps to reproduce:
- Create Dockerfile, similar to above
- Run docker build command for a .NET Core console application (replace abc.csproj)
- Run docker run command using container ID
- Copy publish contents to local file system and review EXE file Details