-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Generated .exe file is missing version info #4127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you publish the app without |
The generated .dll gets the metadata inside the container as well as directly on my machine. The .exe doesn't get the metadata even without those properties inside of the container |
@swaroop-sridhar any feedback on this? |
@wli3 This issue should probably be moved to Runtime repo (wrt HostWriter) |
@swaroop-sridhar after Immo's permission change, no one can move issues anymore. So i will just use the old copy paste issue mover, is that ok? |
@wli3 @swaroop-sridhar would that be here https://github.com/dotnet/runtime/issues? I am happy to create a copy there, if that helps |
@tfenster, yes that's the right repo. Let's keep the issue here for now, until we figure out how to transfer the issue. Thanks. |
I seem to have the exact same issue, and it is reproducible. |
@bravecobra absolutely 100% and easily reproducible. Unfortunately there hasn't been any feedback apart from discussing whether or not this is the right repo and how to maybe get it somewhere else @swaroop-sridhar @wli3 any progress on this? |
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. |
@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 dotnet/runtime#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 dotnet/runtime#3828. |
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:
dotnet new console -o client
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
c:\app\publish\client.exe
. It should show something like this, as is correct in my opiniondocker 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 containerdotnet 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<full-path>\client\publish\
. It should show something like this, in my opinion a bugdotnet --version
shows3.1.100
in both cases. Am I missing something?The text was updated successfully, but these errors were encountered: