Generated .exe file is missing version info
See original GitHub issueIf I publish my 3.1 console app using the following command, then the resulting .exe file does have the version info set:
dotnet publish "client.csproj" -c Release -r win-x64 --self-contained true /property:PublishTrimmed=true /property:PublishSingleFile=true /property:Version=0.1.0.0 -o /app/publish
If I do the exact same thing in a container using the mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 image, the resulting .exe file does not have the version info set.
Steps to repro:
- Create a sample console project using
dotnet new console -o client
- cd client
- Run
dotnet publish "client.csproj" -c Release -r win-x64 --self-contained true /property:PublishTrimmed=true /property:PublishSingleFile=true /property:Version=0.1.0.0 -o /app/publish
- Check the properties of file
c:\app\publish\client.exe
. It should show something like this, as is correct in my opinion - Run
docker run --rm -ti -v "<full-path>\client:c:\app" mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809
(of course replace<full-path>
with your path) to get a session in the container - cd app
- Run
dotnet publish "client.csproj" -c Release -r win-x64 --self-contained true /property:PublishTrimmed=true /property:PublishSingleFile=true /property:Version=0.1.0.0 -o /app/publish
, exactly as above - Check the properties of file
<full-path>\client\publish\
. It should show something like this, in my opinion a bug
dotnet --version
shows 3.1.100
in both cases. Am I missing something?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Generated assembly (exe) has no product version/file ...
The easy solution is to replicate the version information from the dll to the exe. The perfect solution is to have this on...
Read more >How do I set the version information for an existing .exe, .dll?
For a file that is missing version info completely: After opening the DLL in Visual Studio, go to Edit > Add Resource >...
Read more >Visual Studio not creating .exe for C++ Program.
Visual Studio not creating .exe for C++ Program. As a student, I have Visual Studio 2022 Preview. I installed it just yesterday and...
Read more >VERSIONINFO resource - Win32 apps
Defines a version-information resource. The resource contains such information about the file as its version number, its intended operating ...
Read more >Missing "Company name" information when building a .EXE
Re: Missing "Company name" information when building a .EXE Make sure that the file exists, and that it has a [REGISTRATION] section, with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tfenster @bravecobra I think I understand the problem here.
The PE resources are transferred from App.dll to the host App.exe only when building on Windows – because the resource handling code currently uses native Win32 API. So, when the app is published from Linux or nanoserver, the resources are not transfered.
There is an issue https://github.com/dotnet/runtime/issues/3828 filed for implementing ResourceUpdater in managed code. Once this happens, the version information will be transfered regardless of the host machine configuration.
@wli3 I think we can resolve this issue as a dup of https://github.com/dotnet/runtime/issues/3828. Isn’t it?
I can confirm that the version information is compiled into the assembly. With reflection you get the correct version from the assembly itself, however that information isn’t copied to the PE header when building on Linux/container targeting win-x64.