-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
The C# and VB compilers offer a command-line option /deterministic
but that option doesn't have documentation.
Tagging @BillWagner
Tell us where this topic should go in the Table of Contents.
For C#, it should be listed in
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/listed-alphabetically
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/listed-by-category (under Output Files)
Similarly, for VB, it should be listed in
- https://docs.microsoft.com/en-us/dotnet/visual-basic/reference/command-line-compiler/compiler-options-listed-alphabetically
- https://docs.microsoft.com/en-us/dotnet/visual-basic/reference/command-line-compiler/compiler-options-listed-by-category (under Output Files)
There should also be an entry for Deterministic
flag in MSBuild at https://docs.microsoft.com/en-us/visualstudio/msbuild/csc-task and https://docs.microsoft.com/en-us/visualstudio/msbuild/vbc-task
Write an abstract
When the /deterministic flag is passed, the compiler(s) will produce a deterministic assembly (including module version GUID and timestamp). That means that the same byte-for-byte output will be produced given the same inputs.
Fill in an outline
- One-line summary (see abstract above)
- Syntax (that's just
/deterministic
) - Remarks
Here's the documentation that the compiler repo has so far:
https://github.com/dotnet/roslyn/blob/master/docs/compilers/Deterministic%20Inputs.md
Some points for remarks:
- The module version GUID (MVID) is set deterministically, based on bits emitted, instead of a new GUID
- The version of the assembly will be set deterministically, so wildcards in
AssemblyVersionAttribute
are disallowed - The timestamp of the assembly is also set deterministically, instead of recording the time when the bits where emitted
@gafter can help fill-in the blanks.
Suggest reviewers
Relates to https://github.com/MicrosoftDocs/visualstudio-docs/issues/361 and dotnet/roslyn#372