question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated .exe file is missing version info

See original GitHub issue

If 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:

  1. Create a sample console project using dotnet new console -o client
  2. cd client
  3. 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
  4. Check the properties of file c:\app\publish\client.exe. It should show something like this, as is correct in my opinion image
  5. 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
  6. cd app
  7. 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
  8. Check the properties of file <full-path>\client\publish\. It should show something like this, in my opinion a bug image

dotnet --version shows 3.1.100 in both cases. Am I missing something?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
swaroop-sridharcommented, Feb 12, 2020

@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?

0reactions
bravecobracommented, Feb 12, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found