Skip to content

Commit cc76ba7

Browse files
authored
just use runtime (#50279)
1 parent 653c46c commit cc76ba7

File tree

62 files changed

+573
-573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+573
-573
lines changed

docs/standard/analyzers/platform-compat-analyzer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ The following code snippet shows how you can combine attributes to set the right
216216

217217
The recommended way to deal with these diagnostics is to make sure you only call platform-specific APIs when running on an appropriate platform. Following are the options you can use to address the warnings; choose whichever is most appropriate for your situation:
218218

219-
- **Guard the call**. You can achieve this by conditionally calling the code at run time. Check whether you're running on a desired `Platform` by using one of platform-check methods, for example, `OperatingSystem.Is<Platform>()` or `OperatingSystem.Is<Platform>VersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0)`. [Example](#guard-platform-specific-apis-with-guard-methods).
219+
- **Guard the call**. You can achieve this by conditionally calling the code at runtime. Check whether you're running on a desired `Platform` by using one of platform-check methods, for example, `OperatingSystem.Is<Platform>()` or `OperatingSystem.Is<Platform>VersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0)`. [Example](#guard-platform-specific-apis-with-guard-methods).
220220

221221
- **Mark the call site as platform-specific**. You can also choose to mark your own APIs as being platform-specific, thus effectively just forwarding the requirements to your callers. Mark the containing method or type or the entire assembly with the same attributes as the referenced platform-dependent call. [Examples](#mark-call-site-as-platform-specific).
222222

223-
- **Assert the call site with platform check**. If you don't want the overhead of an additional `if` statement at run time, use <xref:System.Diagnostics.Debug.Assert(System.Boolean)?displayProperty=nameWithType>. [Example](#assert-the-call-site-with-platform-check).
223+
- **Assert the call site with platform check**. If you don't want the overhead of an additional `if` statement at runtime, use <xref:System.Diagnostics.Debug.Assert(System.Boolean)?displayProperty=nameWithType>. [Example](#assert-the-call-site-with-platform-check).
224224

225225
- **Delete the code**. Generally not what you want because it means you lose fidelity when your code is used by Windows users. For cases where a cross-platform alternative exists, you're likely better off using that over platform-specific APIs.
226226

docs/standard/assembly/create-use-strong-named.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The following scenario outlines the process of signing an assembly with a strong
4040

4141
3. Assembly B is a consumer of Assembly A. The reference section of Assembly B's manifest includes a token that represents Assembly A's public key. A token is a portion of the full public key and is used rather than the key itself to save space.
4242

43-
4. The common language runtime verifies the strong name signature when the assembly is placed in the global assembly cache. When binding by strong name at run time, the common language runtime compares the key stored in Assembly B's manifest with the key used to generate the strong name for Assembly A. If the .NET security checks pass and the bind succeeds, Assembly B has a guarantee that Assembly A's bits have not been tampered with and that these bits actually come from the developers of Assembly A.
43+
4. The common language runtime verifies the strong name signature when the assembly is placed in the global assembly cache. When binding by strong name at runtime, the common language runtime compares the key stored in Assembly B's manifest with the key used to generate the strong name for Assembly A. If the .NET security checks pass and the bind succeeds, Assembly B has a guarantee that Assembly A's bits have not been tampered with and that these bits actually come from the developers of Assembly A.
4444

4545
> [!NOTE]
4646
> This scenario doesn't address trust issues. Assemblies can carry full Microsoft Authenticode signatures in addition to a strong name. Authenticode signatures include a certificate that establishes trust. It's important to note that strong names don't require code to be signed in this way. Strong names only provide a unique identity.
@@ -68,7 +68,7 @@ This feature can be disabled for individual applications or for a computer. See
6868
|[How to: Create a public-private key pair](create-public-private-key-pair.md)|Describes how to create a cryptographic key pair for signing an assembly.|
6969
|[How to: Sign an assembly with a strong name](sign-strong-name.md)|Describes how to create a strong-named assembly.|
7070
|[Enhanced strong naming](enhanced-strong-naming.md)|Describes enhancements to strong-names in the .NET Framework 4.5.|
71-
|[How to: Reference a strong-named assembly](reference-strong-named.md)|Describes how to reference types or resources in a strong-named assembly at compile time or run time.|
71+
|[How to: Reference a strong-named assembly](reference-strong-named.md)|Describes how to reference types or resources in a strong-named assembly at compile time or runtime.|
7272
|[How to: Disable the strong-name bypass feature](disable-strong-name-bypass-feature.md)|Describes how to disable the feature that bypasses the validation of strong-name signatures. This feature can be disabled for all or for specific applications.|
7373
|[Create assemblies](create.md)|Provides an overview of single-file and multifile assemblies.|
7474
|[How to delay sign an assembly in Visual Studio](/visualstudio/ide/managing-assembly-and-manifest-signing#how-to-sign-an-assembly-in-visual-studio)|Explains how to sign an assembly with a strong name after the assembly has been created.|

docs/standard/assembly/file-format.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ Assembly Headers from ECMA 335 II.25.1, Structure of the runtime file format.
2828

2929
## Process the assemblies
3030

31-
It is possible to write tools or APIs to process assemblies. Assembly information enables making programmatic decisions at run time, rewriting assemblies, providing API IntelliSense in an editor, and generating documentation. <xref:System.Reflection?displayProperty=nameWithType>, <xref:System.Reflection.MetadataLoadContext?displayProperty=nameWithType>, and [Mono.Cecil](https://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cecil/) are good examples of tools that are frequently used for this purpose.
31+
It is possible to write tools or APIs to process assemblies. Assembly information enables making programmatic decisions at runtime, rewriting assemblies, providing API IntelliSense in an editor, and generating documentation. <xref:System.Reflection?displayProperty=nameWithType>, <xref:System.Reflection.MetadataLoadContext?displayProperty=nameWithType>, and [Mono.Cecil](https://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cecil/) are good examples of tools that are frequently used for this purpose.

docs/standard/assembly/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ In C#, you can use two versions of the same assembly in a single application. Fo
103103
|[Assembly placement](../../framework/app-domains/assembly-placement.md)|Where to locate assemblies.|
104104
|[Assemblies and side-by-side execution](side-by-side-execution.md)|Use multiple versions of the runtime or an assembly simultaneously.|
105105
|[Emit dynamic methods and assemblies](../../fundamentals/reflection/emitting-dynamic-methods-and-assemblies.md)|How to create dynamic assemblies.|
106-
|[How the runtime locates assemblies](../../framework/deployment/how-the-runtime-locates-assemblies.md)|How the .NET Framework resolves assembly references at run time.|
106+
|[How the runtime locates assemblies](../../framework/deployment/how-the-runtime-locates-assemblies.md)|How the .NET Framework resolves assembly references at runtime.|
107107

108108
## Reference
109109

docs/standard/assembly/reference-strong-named.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,55 @@
22
title: "How to: Reference a strong-named assembly"
33
description: This article shows you how to reference types or resources in a strong-named .NET assembly, either at compile time or runtime.
44
ms.date: "08/20/2019"
5-
helpviewer_keywords:
5+
helpviewer_keywords:
66
- "strong-named assemblies, compile-time references"
77
- "compile-time assembly referencing"
88
- "assemblies [.NET], strong-named"
99
- "assembly binding, strong-named"
1010
ms.topic: how-to
11-
dev_langs:
11+
dev_langs:
1212
- "csharp"
1313
- "vb"
1414
- "cpp"
1515
---
1616
# How to: Reference a strong-named assembly
1717

18-
The process for referencing types or resources in a strong-named assembly is usually transparent. You can make the reference either at compile time (early binding) or at run time.
19-
18+
The process for referencing types or resources in a strong-named assembly is usually transparent. You can make the reference either at compile time (early binding) or at runtime.
19+
2020
A compile-time reference occurs when you indicate to the compiler that the assembly to be compiled explicitly references another assembly. When you use compile-time referencing, the compiler automatically gets the public key of the targeted strong-named assembly and places it in the assembly reference of the assembly being compiled.
21-
21+
2222
> [!NOTE]
23-
> A strong-named assembly can only use types from other strong-named assemblies. Otherwise, the security of the strong-named assembly would be compromised.
24-
25-
## Make a compile-time reference to a strong-named assembly
23+
> A strong-named assembly can only use types from other strong-named assemblies. Otherwise, the security of the strong-named assembly would be compromised.
24+
25+
## Make a compile-time reference to a strong-named assembly
2626

27-
At a command prompt, type the following command:
27+
At a command prompt, type the following command:
2828

29-
\<*compiler command*> **/reference:**\<*assembly name*>
29+
\<*compiler command*> **/reference:**\<*assembly name*>
3030

31-
In this command, *compiler command* is the compiler command for the language you are using, and *assembly name* is the name of the strong-named assembly being referenced. You can also use other compiler options, such as the **/t:library** option for creating a library assembly.
31+
In this command, *compiler command* is the compiler command for the language you are using, and *assembly name* is the name of the strong-named assembly being referenced. You can also use other compiler options, such as the **/t:library** option for creating a library assembly.
3232

33-
The following example creates an assembly called *myAssembly.dll* that references a strong-named assembly called *myLibAssembly.dll* from a code module called *myAssembly.cs*.
33+
The following example creates an assembly called *myAssembly.dll* that references a strong-named assembly called *myLibAssembly.dll* from a code module called *myAssembly.cs*.
3434

3535
```cmd
36-
csc /t:library myAssembly.cs /reference:myLibAssembly.dll
37-
```
36+
csc /t:library myAssembly.cs /reference:myLibAssembly.dll
37+
```
38+
39+
## Make a runtime reference to a strong-named assembly
3840

39-
## Make a run-time reference to a strong-named assembly
40-
41-
When you make a run-time reference to a strong-named assembly, for example by using the <xref:System.Reflection.Assembly.Load%2A?displayProperty=nameWithType> or <xref:System.Reflection.Assembly.GetType%2A?displayProperty=nameWithType> method, you must use the display name of the referenced strong-named assembly. The syntax of a display name is as follows:
41+
When you make a runtime reference to a strong-named assembly, for example by using the <xref:System.Reflection.Assembly.Load%2A?displayProperty=nameWithType> or <xref:System.Reflection.Assembly.GetType%2A?displayProperty=nameWithType> method, you must use the display name of the referenced strong-named assembly. The syntax of a display name is as follows:
4242

43-
\<*assembly name*>**,** \<*version number*>**,** \<*culture*>**,** \<*public key token*>
43+
\<*assembly name*>**,** \<*version number*>**,** \<*culture*>**,** \<*public key token*>
4444

45-
For example:
45+
For example:
4646

4747
```console
4848
myDll, Version=1.1.0.0, Culture=en, PublicKeyToken=03689116d3a4ae33
49-
```
49+
```
5050

51-
In this example, `PublicKeyToken` is the hexadecimal form of the public key token. If there is no culture value, use `Culture=neutral`.
51+
In this example, `PublicKeyToken` is the hexadecimal form of the public key token. If there is no culture value, use `Culture=neutral`.
5252

53-
The following code example shows how to use this information with the <xref:System.Reflection.Assembly.Load%2A?displayProperty=nameWithType> method.
53+
The following code example shows how to use this information with the <xref:System.Reflection.Assembly.Load%2A?displayProperty=nameWithType> method.
5454

5555
```cpp
5656
Assembly^ myDll =
@@ -67,13 +67,13 @@ Dim myDll As Assembly = _
6767
Assembly.Load("myDll, Version=1.0.0.1, Culture=neutral, PublicKeyToken=9b35aa32c18d4fb1")
6868
```
6969

70-
You can print the hexadecimal format of the public key and public key token for a specific assembly by using the following [Strong Name (Sn.exe)](../../framework/tools/sn-exe-strong-name-tool.md) command:
70+
You can print the hexadecimal format of the public key and public key token for a specific assembly by using the following [Strong Name (Sn.exe)](../../framework/tools/sn-exe-strong-name-tool.md) command:
7171

72-
**sn -Tp \<** *assembly* **>**
72+
**sn -Tp \<** *assembly* **>**
7373

74-
If you have a public key file, you can use the following command instead (note the difference in case on the command-line option):
74+
If you have a public key file, you can use the following command instead (note the difference in case on the command-line option):
7575

76-
**sn -tp \<** *public key file* **>**
76+
**sn -tp \<** *public key file* **>**
7777

7878
## See also
7979

docs/standard/assembly/set-attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You can use informational attributes to provide additional company or product in
6868
| <xref:System.Reflection.AssemblyCompanyAttribute> | String value specifying a company name. |
6969
| <xref:System.Reflection.AssemblyCopyrightAttribute> | String value specifying copyright information. |
7070
| <xref:System.Reflection.AssemblyFileVersionAttribute> | String value specifying the Win32 file version number. This normally defaults to the assembly version. |
71-
| <xref:System.Reflection.AssemblyInformationalVersionAttribute> | String value specifying version information that is not used by the common language runtime, such as a full product version number. **Note:** If this attribute is applied to an assembly, the string it specifies can be obtained at run time by using the <xref:System.Windows.Forms.Application.ProductVersion%2A?displayProperty=nameWithType> property. The string is also used in the path and registry key provided by the <xref:System.Windows.Forms.Application.UserAppDataPath%2A?displayProperty=nameWithType> and <xref:System.Windows.Forms.Application.UserAppDataRegistry%2A?displayProperty=nameWithType> properties. |
71+
| <xref:System.Reflection.AssemblyInformationalVersionAttribute> | String value specifying version information that is not used by the common language runtime, such as a full product version number. **Note:** If this attribute is applied to an assembly, the string it specifies can be obtained at runtime by using the <xref:System.Windows.Forms.Application.ProductVersion%2A?displayProperty=nameWithType> property. The string is also used in the path and registry key provided by the <xref:System.Windows.Forms.Application.UserAppDataPath%2A?displayProperty=nameWithType> and <xref:System.Windows.Forms.Application.UserAppDataRegistry%2A?displayProperty=nameWithType> properties. |
7272
| <xref:System.Reflection.AssemblyProductAttribute> | String value specifying product information. |
7373
| <xref:System.Reflection.AssemblyTrademarkAttribute> | String value specifying trademark information. |
7474

docs/standard/assembly/side-by-side-execution.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
title: "Assemblies and side-by-side execution"
33
description: Learn about side-by-side execution, which is the ability to store and run multiple versions of an application or component on the same computer.
44
ms.date: "08/20/2019"
5-
helpviewer_keywords:
5+
helpviewer_keywords:
66
- "side-by-side execution [.NET]"
77
- "assemblies [.NET], side-by-side execution"
88
ms.assetid: e42036ee-7590-47d1-b884-cc856e39bd5d
99
---
1010
# Assemblies and side-by-side execution
1111

12-
Side-by-side execution is the ability to store and execute multiple versions of an application or component on the same computer. This means that you can have multiple versions of the runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Side-by-side execution gives you more control over what versions of a component an application binds to, and more control over what version of the runtime an application uses.
13-
14-
Support for side-by-side storage and execution of different versions of the same assembly is an integral part of strong naming and is built into the infrastructure of the runtime. Because the strong-named assembly's version number is part of its identity, the runtime can store multiple versions of the same assembly in the global assembly cache and load those assemblies at run time.
15-
16-
Although the runtime provides you with the ability to create side-by-side applications, side-by-side execution is not automatic. For more information on creating applications for side-by-side execution, see [Guidelines for creating components for side-by-side execution](../../framework/deployment/guidelines-for-creating-components-for-side-by-side-execution.md).
17-
12+
Side-by-side execution is the ability to store and execute multiple versions of an application or component on the same computer. This means that you can have multiple versions of the runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Side-by-side execution gives you more control over what versions of a component an application binds to, and more control over what version of the runtime an application uses.
13+
14+
Support for side-by-side storage and execution of different versions of the same assembly is an integral part of strong naming and is built into the infrastructure of the runtime. Because the strong-named assembly's version number is part of its identity, the runtime can store multiple versions of the same assembly in the global assembly cache and load those assemblies at runtime.
15+
16+
Although the runtime provides you with the ability to create side-by-side applications, side-by-side execution is not automatic. For more information on creating applications for side-by-side execution, see [Guidelines for creating components for side-by-side execution](../../framework/deployment/guidelines-for-creating-components-for-side-by-side-execution.md).
17+
1818
## See also
1919

2020
- [How the runtime locates assemblies](../../framework/deployment/how-the-runtime-locates-assemblies.md)

0 commit comments

Comments
 (0)