Skip to content

Add SCCSID to AOT published shipping binaries - #7600

Merged
MichalStrehovsky merged 6 commits into
dotnet:mainfrom
am11:feature/nativeaot/sccsid
Jul 15, 2026
Merged

MichalStrehovsky merged 6 commits into
dotnet:mainfrom
am11:feature/nativeaot/sccsid

Conversation

@am11

@am11 am11 commented Jul 8, 2026

Copy link
Copy Markdown
Member
$ strings libaspnetcoretools.so | grep '@(#)'
@(#)Version 11.0.26.35999 @Commit: 666180633e44fd2a7af63577d024bc630075f93b

$ strings crossgen2 | grep '@(#)'
@(#)Version 11.0.26.35999 @Commit: 666180633e44fd2a7af63577d024bc630075f93b

$ strings ilc | grep '@(#)'
@(#)Version 11.0.26.35999 @Commit: 666180633e44fd2a7af63577d024bc630075f93b

Fixes dotnet/aspnetcore#67637.

@am11
am11 force-pushed the feature/nativeaot/sccsid branch from 14ab3f1 to 10be6b9 Compare July 8, 2026 17:41
@am11

am11 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

@MichalStrehovsky, PTAL.

@MichalStrehovsky

Copy link
Copy Markdown
Member

@MichalStrehovsky, PTAL.

Sorry, I'm not the best person to review this. I literally wrote "I don't have an opinion on this. I don't know why we include _version.c in the first place.". As far as I'm concerned, it's useless information and I would not sign off on a change that doesn't do anything useful because we still need to maintain it.

It will add this string to native AOT outputs, so from that perspective I'm happy to sign off, provided we need this.

@am11

am11 commented Jul 13, 2026 •

Copy link
Copy Markdown
Member Author

I don't know why we include _version.c in the first place.

It's a unix convention https://en.wikipedia.org/wiki/Source_Code_Control_System. Windows binaries have PE metadata populated via source link, so _version.c is the unix-y answer to that.

As far as I'm concerned, it's useless information and I would not sign off on a change that doesn't do anything useful because we still need to maintain it.

Off the top of my head, three current use-cases:

  • we use it for diagnostics and to answer like "which commit"
  • corehost prints that value with DOTNET_HOST_TRACING
  • libSOS uses it to find matching runtime by commit.

One may not be a fan of it but it certainly is not useless. We are adding SCCSID in "native binaries shipped in .NET". This is to make it consistent "nativeaot published binaries shipped by .NET". I think it should be fine.

cc @jkotas

@MichalStrehovsky

Copy link
Copy Markdown
Member

Okay, I'm fine with it. Found the original motivation for the use in our repos at dotnet/runtime#5107.

Do you have an opinion on whether we should match the version.c inclusion rules? (I assume we don't include version.c on Windows at minimum.)

@akoeplinger

Copy link
Copy Markdown
Member

I agree we shouldn't emit this on Windows, it has no meaning there.

I'm a bit torn on the approach, I don't like that we need to remember to include the target everywhere we have a NativeAOT'd app.

I saw that at least on Windows the NativeAOT'd .exe still contains the PE Copyright / ProductVersion fields from somewhere, I assume it propagates them from the original .NET assembly? maybe we could do the same for sccsid on Unix?

@am11

am11 commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

I can exclude it but we had this discussion earlier dotnet/runtime#51554 (comment), the idea was we don't want to override PE resource with our version but rather emit it in Windows. The only reason why we don't emit it in apphost is because how arcade infra is written and nobody worked on it.

I will exclude it from here and we can align it once other win32 runtime binaries receive the fix.

@jkotas

jkotas commented Jul 14, 2026

Copy link
Copy Markdown
Member

I'm a bit torn on the approach, I don't like that we need to remember to include the target everywhere we have a NativeAOT'd app.

+1

Can this be done by Arcade targets that generate the @Version resource for the C/C++ binaries?

@am11

am11 commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

@jkotas, you mean #7600 (comment)? We are including files from eng/common/native in all AOT projects. We can unify those in arcade SDK as well. For now there are only four places using AOT in shipping matrix, so we can unify it later as well.

@jkotas

jkotas commented Jul 14, 2026

Copy link
Copy Markdown
Member

I think it would be better to do it correctly right of the gate so that we do not have deal with this again. We have been adopting for tools accros the stack and I expect that it is going to continue.

Can the equivalent of this change be achieved by adding the logic to https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.targets ?

@am11

am11 commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Moved to arcade SDK and verified that it still works: https://github.com/am11/dotnet-riscv/releases/tag/11.0.100-preview.7.26364.199

$ find ~/.dotnet-new -name libaspnetcoretools.so | xargs strings | grep '@(#)'
@(#)Version 11.0.26.36599 @Commit: df02874e4e7bdd772c58bf6342a3756f03b68888

$ find ~/.dotnet-new -name crossgen2 | xargs strings | grep '@(#)'
@(#)Version 11.0.26.36599 @Commit: df02874e4e7bdd772c58bf6342a3756f03b68888

$ find ~/.dotnet-new -name ilc | xargs strings | grep '@(#)'
@(#)Version 11.0.26.36599 @Commit: df02874e4e7bdd772c58bf6342a3756f03b68888

$ find ~/.dotnet-new -name libcoreclr.so | xargs strings | grep '@(#)'
@(#)Version 11.0.26.36599 @Commit: df02874e4e7bdd772c58bf6342a3756f03b68888
@(#)Version 11.0.26.36599 @Commit: df02874e4e7bdd772c58bf6342a3756f03b68888
@(#)Version 11.0.26.36599 @Commit: df02874e4e7bdd772c58bf6342a3756f03b68888
@(#)Version 11.0.26.36599 @Commit: df02874e4e7bdd772c58bf6342a3756f03b68888

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MichalStrehovsky MichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This turned out pretty nice! Thanks!

@MichalStrehovsky
MichalStrehovsky merged commit cb8306a into dotnet:main Jul 15, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aspnetcoretools.so: use source control version string format.

4 participants