dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.11k stars 4.7k forks source link

Generate and embed _version.c in Windows native binaries #79673

Open am11 opened 1 year ago

am11 commented 1 year ago

We only embed sccid string on Unix binaries, because on Windows _version.c is not generated. To support the same in Windows binaries (in addition and unrelated to PE metadata), we would need to update GenerateNativeVersionFile target in arcade, eng/native/version and some CMake and MSBuild scripts.

dotnet-issue-labeler[bot] commented 1 year ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost commented 1 year ago

Tagging subscribers to this area: @dotnet/runtime-infrastructure See info in area-owners.md if you want to be subscribed.

Issue Details
We only embed sccid string on Unix binaries, because on Windows _version.c is not generated. To support the same in Windows binaries (in addition and unrelated to PE metadata), we would need to update `GenerateNativeVersionFile` target in arcade, `eng/native/version` and some CMake and MSBuild scripts.
Author: am11
Assignees: -
Labels: `area-Infrastructure`, `untriaged`
Milestone: -
janvorli commented 1 year ago

@am11 I wonder what would be the benefit of doing that when the same information is in the version resources of the windows dlls / executables?

am11 commented 1 year ago

@janvorli, this was discussed in https://github.com/dotnet/runtime/pull/51835#discussion_r620700656 and it came up again in https://github.com/dotnet/runtime/pull/79623. 1) The embedded string makes it easy to query this information from published .NET applications on any platform from the command line. 2) On Windows, the published apps do not have commit information of dotnet/runtime as they do on Unix; runtime's version resource is not embedded there because we wanted to reserve it for user's version resource.

janvorli commented 1 year ago

Ah, the published apps, I've forgotten about those.