You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Causes the compiler to produce an assembly whose byte-for-byte output is identical across compilations for identical inputs.
20
+
21
+
## Syntax
22
+
23
+
```
24
+
-deterministic
25
+
```
26
+
27
+
## Remarks
28
+
29
+
By default, compiler output from a given set of inputs is unique, since the compiler adds a timestamp and a GUID that is generated from random numbers. You use the `-deterministic` option to produce a *deterministic assembly*, one whose binary content is identical across compilations as long as the input remains the same.
30
+
31
+
The compiler considers the following inputs for the purpose of determinism:
32
+
33
+
- The sequence of command-line parameters.
34
+
- The contents of the compiler's .rsp response file.
35
+
- The precise version of the compiler used, and its referenced assemblies.
36
+
- The current directory path.
37
+
- The binary contents of all files explicitly passed to the compiler either directly or indirectly, including:
38
+
- Source files
39
+
- Referenced assemblies
40
+
- Referenced modules
41
+
- Resources
42
+
- The strong name key file
43
+
- @ response files
44
+
- Analyzers
45
+
- Rulesets
46
+
- Additional files that may be used by analyzers
47
+
- The current culture (for the language in which diagnostics and exception messages are produced).
48
+
- The default encoding (or the current code page) if the encoding is not specified.
49
+
- The existence, non-existence, and contents of files on the compiler's search paths (specified, for example, by `/lib` or `/recurse`).
50
+
- The CLR platform on which the compiler is run.
51
+
- The value of `%LIBPATH%`, which can affect analyzer dependency loading.
52
+
53
+
When sources are publicly available, deterministic compilation can be used for establishing whether a binary is compiled from a trusted source. It can also be useful in a continuous build system for determining whether build steps that are dependent on changes to a binary need to be executed.
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/compiler-options/link-compiler-option.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ Causes the compiler to make COM type information in the specified assemblies ava
44
44
> [!NOTE]
45
45
> When you create an instance of an embedded COM type in your code, you must create the instance by using the appropriate interface. Attempting to create an instance of an embedded COM type by using the CoClass causes an error.
46
46
47
-
To set the `-link` option in [!INCLUDE[vsprvs](~/includes/vsprvs-md.md)], add an assembly reference and set the `Embed Interop Types` property to **true**. The default for the `Embed Interop Types` property is **false**.
47
+
To set the `-link` option in Visual Studio, add an assembly reference and set the `Embed Interop Types` property to **true**. The default for the `Embed Interop Types` property is **false**.
48
48
49
49
If you link to a COM assembly (Assembly A) which itself references another COM assembly (Assembly B), you also have to link to Assembly B if either of the following is true:
The following compiler options are sorted alphabetically. For a categorical list, see [C# Compiler Options Listed by Category](../../../csharp/language-reference/compiler-options/listed-by-category.md).
19
+
The following compiler options are sorted alphabetically. For a categorical list, see [C# Compiler Options Listed by Category](listed-by-category.md).
20
20
21
21
|Option|Purpose|
22
22
|------------|-------------|
23
-
|[@](../../../csharp/language-reference/compiler-options/response-file-compiler-option.md)|Reads a response file for more options.|
24
-
|[-?](../../../csharp/language-reference/compiler-options/help-compiler-option.md)|Displays a usage message to stdout.|
23
+
|[@](response-file-compiler-option.md)|Reads a response file for more options.|
24
+
|[-?](help-compiler-option.md)|Displays a usage message to stdout.|
25
25
|-additionalfile|Names additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings.|
26
-
|[-addmodule](../../../csharp/language-reference/compiler-options/addmodule-compiler-option.md)|Links the specified modules into this assembly|
26
+
|[-addmodule](addmodule-compiler-option.md)|Links the specified modules into this assembly|
27
27
|-analyzer|Run the analyzers from this assembly (Short form: -a)|
28
-
|[-appconfig](../../../csharp/language-reference/compiler-options/appconfig-compiler-option.md)|Specifies the location of app.config at assembly binding time.|
29
-
|[-baseaddress](../../../csharp/language-reference/compiler-options/baseaddress-compiler-option.md)|Specifies the base address for the library to be built.|
30
-
|[-bugreport](../../../csharp/language-reference/compiler-options/bugreport-compiler-option.md)|Creates a 'Bug Report' file. This file will be sent together with any crash information if it is used with -errorreport:prompt or -errorreport:send.|
31
-
|[-checked](../../../csharp/language-reference/compiler-options/checked-compiler-option.md)|Causes the compiler to generate overflow checks.|
28
+
|[-appconfig](appconfig-compiler-option.md)|Specifies the location of app.config at assembly binding time.|
29
+
|[-baseaddress](baseaddress-compiler-option.md)|Specifies the base address for the library to be built.|
30
+
|[-bugreport](bugreport-compiler-option.md)|Creates a 'Bug Report' file. This file will be sent together with any crash information if it is used with -errorreport:prompt or -errorreport:send.|
31
+
|[-checked](checked-compiler-option.md)|Causes the compiler to generate overflow checks.|
32
32
|-checksumalgorithm:\<alg>|Specify the algorithm for calculating the source file checksum stored in PDB. Supported values are: SHA1 (default) or SHA256.|
33
-
|[-codepage](../../../csharp/language-reference/compiler-options/codepage-compiler-option.md)|Specifies the codepage to use when opening source files.|
|[-delaysign](../../../csharp/language-reference/compiler-options/delaysign-compiler-option.md)|Delay-signs the assembly by using only the public part of the strong name key.|
37
-
|[-doc](../../../csharp/language-reference/compiler-options/doc-compiler-option.md)|Specifies an XML Documentation file to generate.|
38
-
|[-errorreport](../../../csharp/language-reference/compiler-options/errorreport-compiler-option.md)|Specifies how to handle internal compiler errors: prompt, send, or none. The default is none.|
39
-
|[-filealign](../../../csharp/language-reference/compiler-options/filealign-compiler-option.md)|Specifies the alignment used for output file sections.|
40
-
|[-fullpaths](../../../csharp/language-reference/compiler-options/fullpaths-compiler-option.md)|Causes the compiler to generate fully qualified paths.|
41
-
|[-help](../../../csharp/language-reference/compiler-options/help-compiler-option.md)|Displays a usage message to stdout.|
42
-
|[-highentropyva](../../../csharp/language-reference/compiler-options/highentropyva-compiler-option.md)|Specifies that high entropy ASLR is supported.|
33
+
|[-codepage](codepage-compiler-option.md)|Specifies the codepage to use when opening source files.|
|[-delaysign](delaysign-compiler-option.md)|Delay-signs the assembly by using only the public part of the strong name key.|
37
+
|[-deterministic](deterministic-compiler-option.md)|Causes the compiler to output an assembly whose binary content is identical across compilations if inputs are identical.|
38
+
|[-doc](doc-compiler-option.md)|Specifies an XML Documentation file to generate.|
39
+
|[-errorreport](errorreport-compiler-option.md)|Specifies how to handle internal compiler errors: prompt, send, or none. The default is none.|
40
+
|[-filealign](filealign-compiler-option.md)|Specifies the alignment used for output file sections.|
41
+
|[-fullpaths](fullpaths-compiler-option.md)|Causes the compiler to generate fully qualified paths.|
42
+
|[-help](help-compiler-option.md)|Displays a usage message to stdout.|
43
+
|[-highentropyva](highentropyva-compiler-option.md)|Specifies that high entropy ASLR is supported.|
|[-keycontainer](../../../csharp/language-reference/compiler-options/keycontainer-compiler-option.md)|Specifies a strong name key container.|
45
-
|[-keyfile](../../../csharp/language-reference/compiler-options/keyfile-compiler-option.md)|Specifies a strong name key file.|
46
-
|[-langversion:\<string>](../../../csharp/language-reference/compiler-options/langversion-compiler-option.md)|Specify language version mode: Default, ISO-1, ISO-2, 3, 4, 5, 6, 7, 7.1, or Latest |
47
-
|[-lib](../../../csharp/language-reference/compiler-options/lib-compiler-option.md)|Specifies additional directories in which to search for references.|
48
-
|[-link](../../../csharp/language-reference/compiler-options/link-compiler-option.md)|Makes COM type information in specified assemblies available to the project.|
49
-
|[-linkresource](../../../csharp/language-reference/compiler-options/linkresource-compiler-option.md)|Links the specified resource to this assembly.|
50
-
|[-main](../../../csharp/language-reference/compiler-options/main-compiler-option.md)|Specifies the type that contains the entry point (ignore all other possible entry points).|
51
-
|[-moduleassemblyname](../../../csharp/language-reference/compiler-options/moduleassemblyname-compiler-option.md)|Specifies an assembly whose non-public types a .netmodule can access.|
45
+
|[-keycontainer](keycontainer-compiler-option.md)|Specifies a strong name key container.|
46
+
|[-keyfile](keyfile-compiler-option.md)|Specifies a strong name key file.|
47
+
|[-langversion:\<string>](langversion-compiler-option.md)|Specify language version mode: Default, ISO-1, ISO-2, 3, 4, 5, 6, 7, 7.1, or Latest |
48
+
|[-lib](lib-compiler-option.md)|Specifies additional directories in which to search for references.|
49
+
|[-link](link-compiler-option.md)|Makes COM type information in specified assemblies available to the project.|
50
+
|[-linkresource](linkresource-compiler-option.md)|Links the specified resource to this assembly.|
51
+
|[-main](main-compiler-option.md)|Specifies the type that contains the entry point (ignore all other possible entry points).|
52
+
|[-moduleassemblyname](moduleassemblyname-compiler-option.md)|Specifies an assembly whose non-public types a .netmodule can access.|
52
53
|-modulename:\<string>|Specify the name of the source module|
53
-
|[-noconfig](../../../csharp/language-reference/compiler-options/noconfig-compiler-option.md)|Instructs the compiler not to auto include CSC.RSP file.|
|[-nostdlib](../../../csharp/language-reference/compiler-options/nostdlib-compiler-option.md)|Instructs the compiler not to reference standard library (mscorlib.dll).|
56
-
|[-nowarn](../../../csharp/language-reference/compiler-options/nowarn-compiler-option.md)|Disables specific warning messages|
57
-
|[-nowin32manifest](../../../csharp/language-reference/compiler-options/nowin32manifest-compiler-option.md)|Instructs the compiler not to embed an application manifest in the executable file.|
|[-out](../../../csharp/language-reference/compiler-options/out-compiler-option.md)|Specifies the output file name (default: base name of file with main class or first file).|
54
+
|[-noconfig](noconfig-compiler-option.md)|Instructs the compiler not to auto include CSC.RSP file.|
|[-out](out-compiler-option.md)|Specifies the output file name (default: base name of file with main class or first file).|
60
61
|-parallel[+|-]|Specifies whether to use concurrent build (+).|
61
-
|[-pdb](../../../csharp/language-reference/compiler-options/pdb-compiler-option.md)|Specifies the file name and location of the .pdb file.|
62
-
|[-platform](../../../csharp/language-reference/compiler-options/platform-compiler-option.md)|Limits which platforms this code can run on: x86, Itanium, x64, anycpu, or anycpu32bitpreferred. The default is anycpu.|
63
-
|[-preferreduilang](../../../csharp/language-reference/compiler-options/preferreduilang-compiler-option.md)|Specifies the language to be used for compiler output.|
64
-
|[-recurse](../../../csharp/language-reference/compiler-options/recurse-compiler-option.md)|Includes all files in the current directory and subdirectories according to the wildcard specifications.|
65
-
|[-reference](../../../csharp/language-reference/compiler-options/reference-compiler-option.md)|References metadata from the specified assembly files.|
62
+
|[-pdb](pdb-compiler-option.md)|Specifies the file name and location of the .pdb file.|
63
+
|[-platform](platform-compiler-option.md)|Limits which platforms this code can run on: x86, Itanium, x64, anycpu, or anycpu32bitpreferred. The default is anycpu.|
64
+
|[-preferreduilang](preferreduilang-compiler-option.md)|Specifies the language to be used for compiler output.|
65
+
|[-recurse](recurse-compiler-option.md)|Includes all files in the current directory and subdirectories according to the wildcard specifications.|
66
+
|[-reference](reference-compiler-option.md)|References metadata from the specified assembly files.|
66
67
|[-refout](refout-compiler-option.md)|Generate a reference assembly in addition to the primary assembly.|
67
68
|[-refonly](refonly-compiler-option.md)|Generate a reference assembly instead of a primary assembly.|
68
-
|[-resource](../../../csharp/language-reference/compiler-options/resource-compiler-option.md)|Embeds the specified resource.|
69
+
|[-resource](resource-compiler-option.md)|Embeds the specified resource.|
69
70
|-ruleset:\<file>|Specify a ruleset file that disables specific diagnostics.|
70
-
|[-subsystemversion](../../../csharp/language-reference/compiler-options/subsystemversion-compiler-option.md)|Specifies the minimum version of the subsystem that the executable file can use.|
71
-
|[-target](../../../csharp/language-reference/compiler-options/target-compiler-option.md)|Specifies the format of the output file by using one of four options: [-target:appcontainerexe](../../../csharp/language-reference/compiler-options/target-appcontainerexe-compiler-option.md), [-target:exe](../../../csharp/language-reference/compiler-options/target-exe-compiler-option.md), [-target:library](../../../csharp/language-reference/compiler-options/target-library-compiler-option.md), [-target:module](../../../csharp/language-reference/compiler-options/target-module-compiler-option.md), [-target:winexe](../../../csharp/language-reference/compiler-options/target-winexe-compiler-option.md), [-target:winmdobj](../../../csharp/language-reference/compiler-options/target-winmdobj-compiler-option.md).|
|[-utf8output](../../../csharp/language-reference/compiler-options/utf8output-compiler-option.md)|Outputs compiler messages in UTF-8 encoding.|
74
-
|[-warn](../../../csharp/language-reference/compiler-options/warn-compiler-option.md)|Sets the warning level (0-4).|
75
-
|[-warnaserror](../../../csharp/language-reference/compiler-options/warnaserror-compiler-option.md)|Reports specific warnings as errors.|
76
-
|[-win32icon](../../../csharp/language-reference/compiler-options/win32icon-compiler-option.md)|Uses this icon for the output.|
77
-
|[-win32manifest](../../../csharp/language-reference/compiler-options/win32manifest-compiler-option.md)|Specifies a custom win32 manifest file.|
78
-
|[-win32res](../../../csharp/language-reference/compiler-options/win32res-compiler-option.md)|Specifies the win32 resource file (.res).|
71
+
|[-subsystemversion](subsystemversion-compiler-option.md)|Specifies the minimum version of the subsystem that the executable file can use.|
72
+
|[-target](target-compiler-option.md)|Specifies the format of the output file by using one of four options: [-target:appcontainerexe](target-appcontainerexe-compiler-option.md), [-target:exe](target-exe-compiler-option.md), [-target:library](target-library-compiler-option.md), [-target:module](target-module-compiler-option.md), [-target:winexe](target-winexe-compiler-option.md), [-target:winmdobj](target-winmdobj-compiler-option.md).|
[C# Compiler Options Listed by Category](../../../csharp/language-reference/compiler-options/listed-by-category.md)
83
-
[How to: Set Environment Variables for the Visual Studio Command Line](../../../csharp/language-reference/compiler-options/how-to-set-environment-variables-for-the-visual-studio-command-line.md)
82
+
[C# Compiler Options](index.md)
83
+
[C# Compiler Options Listed by Category](listed-by-category.md)
84
+
[How to: Set Environment Variables for the Visual Studio Command Line](how-to-set-environment-variables-for-the-visual-studio-command-line.md)
0 commit comments