Skip to content

Commit a392897

Browse files
BillWagnertdykstra
andauthored
Consolidate pragma section (#23374)
* add text for existing issues There are two existing issues in this section of content. This commit fixes both. * combine all files. * first pass at formatting. * restore F1 and helpviewer keywords. * fix build warnings. * organize by scenario, not keyword. * first pass edit. * finish proofreading. * fix warning * run clean-repo to replace links First run: replace redirected file links. * Replace relative links Run clean repo to replace absolute links (introduced in the previous run) with relative links. * Revert "Replace relative links" This reverts commit d3c931e. * run with the new cleanrepo build This way, forward slashes aren't replaced with backslashes. * Apply suggestions from code review Co-authored-by: Tom Dykstra <[email protected]> * respond to code review comments. Co-authored-by: Tom Dykstra <[email protected]>
1 parent f4840c4 commit a392897

Some content is hidden

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

53 files changed

+459
-848
lines changed

.openpublishing.redirection.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,71 @@
15701570
"source_path": "docs/csharp/language-reference/operators/xor-operator.md",
15711571
"redirect_url": "/dotnet/csharp/language-reference/operators/boolean-logical-operators#logical-exclusive-or-operator-"
15721572
},
1573+
{
1574+
"source_path": "docs/csharp/language-reference/preprocessor-directives/index.md",
1575+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives",
1576+
"redirect_document_id":true
1577+
},
1578+
{
1579+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-define.md",
1580+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1581+
},
1582+
{
1583+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-else.md",
1584+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1585+
},
1586+
{
1587+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-elif.md",
1588+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1589+
},
1590+
{
1591+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-endif.md",
1592+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1593+
},
1594+
{
1595+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-endregion.md",
1596+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1597+
},
1598+
{
1599+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-error.md",
1600+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1601+
},
1602+
{
1603+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-if.md",
1604+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1605+
},
1606+
{
1607+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-line.md",
1608+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1609+
},
1610+
{
1611+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-nullable.md",
1612+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1613+
},
1614+
{
1615+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-pragma.md",
1616+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1617+
},
1618+
{
1619+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-pragma-checksum.md",
1620+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1621+
},
1622+
{
1623+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-pragma-warning.md",
1624+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1625+
},
1626+
{
1627+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-region.md",
1628+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1629+
},
1630+
{
1631+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-undef.md",
1632+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1633+
},
1634+
{
1635+
"source_path": "docs/csharp/language-reference/preprocessor-directives/preprocessor-warning.md",
1636+
"redirect_url": "/dotnet/csharp/language-reference/preprocessor-directives"
1637+
},
15731638
{
15741639
"source_path": "docs/csharp/language-reference/proposals/csharp-7.0/index.md",
15751640
"redirect_url": "/dotnet/csharp/language-reference/proposals/csharp-7.0/pattern-matching"

docs/architecture/porting-existing-aspnet-apps/strategies-migrating-in-production.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Once the facade is in place, you can route part of it to a new ASP.NET Core app.
3737

3838
## Multi-targeting approaches
3939

40-
Large apps that target .NET Framework may be migrated to ASP.NET Core over time by using multi-targeting and separate code paths for each framework. For example, code that must run in both environments could be modified with [preprocessor `#if`](../../csharp/language-reference/preprocessor-directives/preprocessor-if.md) directives to implement different functionality or use different dependencies when run in .NET Framework versus .NET Core. Another option is to modify project files to include different sets of files based on which framework is being targeted. Project files can use different globbing patterns, such as `*.core.cs`, to include different sets of source files depending on the framework being targeted.
40+
Large apps that target .NET Framework may be migrated to ASP.NET Core over time by using multi-targeting and separate code paths for each framework. For example, code that must run in both environments could be modified with [preprocessor `#if`](../../csharp/language-reference/preprocessor-directives.md) directives to implement different functionality or use different dependencies when run in .NET Framework versus .NET Core. Another option is to modify project files to include different sets of files based on which framework is being targeted. Project files can use different globbing patterns, such as `*.core.cs`, to include different sets of source files depending on the framework being targeted.
4141

4242
These techniques allow a single common codebase to be maintained while new functionality is added and (parts of) the app are ported to use .NET Core.
4343

docs/csharp/language-reference/builtin-types/built-in-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The following table lists the C# built-in [reference](../keywords/reference-type
3636
|[`string`](reference-types.md#the-string-type)|<xref:System.String?displayProperty=nameWithType>|
3737
|[`dynamic`](reference-types.md#the-dynamic-type)|<xref:System.Object?displayProperty=nameWithType>|
3838

39-
In the preceding tables, each C# type keyword from the left column (except [nint and nuint](nint-nuint.md) and [dynamic](using-type-dynamic.md)) is an alias for the corresponding .NET type. They are interchangeable. For example, the following declarations declare variables of the same type:
39+
In the preceding tables, each C# type keyword from the left column (except [nint and nuint](nint-nuint.md) and [dynamic](reference-types.md#the-dynamic-type)) is an alias for the corresponding .NET type. They are interchangeable. For example, the following declarations declare variables of the same type:
4040

4141
```csharp
4242
int a = 123;

docs/csharp/language-reference/compiler-messages/cs0420.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.assetid: 0f52f508-286e-493d-9151-180e05397bf9
1212

1313
'identifier': a reference to a volatile field will not be treated as volatile
1414

15-
A volatile field should not normally be passed using a `ref` or **out** parameter, since it will not be treated as volatile within the scope of the function. There are exceptions to this, such as when calling an interlocked API. As with any warning, you may use the [#pragma warning](../preprocessor-directives/preprocessor-pragma-warning.md) to disable this warning in those rare cases where you are intentionally using a volatile field as a reference parameter.
15+
A volatile field should not normally be passed using a `ref` or **out** parameter, since it will not be treated as volatile within the scope of the function. There are exceptions to this, such as when calling an interlocked API. As with any warning, you may use the [#pragma warning](../preprocessor-directives.md) to disable this warning in those rare cases where you are intentionally using a volatile field as a reference parameter.
1616

1717
The following sample generates CS0420:
1818

docs/csharp/language-reference/compiler-messages/cs1029.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.assetid: 61bd4d44-9bfc-42bb-a9f0-a0683da53640
1212

1313
\#error: 'text'
1414

15-
Displays the text of an error defined with the [#error](../preprocessor-directives/preprocessor-error.md) directive.
15+
Displays the text of an error defined with the [#error](../preprocessor-directives.md) directive.
1616

1717
The following sample shows how to create a user-defined error:
1818

docs/csharp/language-reference/compiler-messages/cs1691.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.assetid: 7f0fea4d-4215-446c-a249-57daa7e967d2
1212

1313
'number' is not a valid warning number
1414

15-
A number that was passed to the [#pragma warning](../preprocessor-directives/preprocessor-pragma-warning.md) preprocessor directive was not a valid warning number. Verify that the number represents a warning, not an error or another sequence of characters.
15+
A number that was passed to the [#pragma warning](../preprocessor-directives.md) preprocessor directive was not a valid warning number. Verify that the number represents a warning, not an error or another sequence of characters.
1616

1717
## Example
1818

docs/csharp/language-reference/compiler-messages/cs4014.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Exiting the Click event handler.
7474
Task.Delay is finished--returning from called method.
7575
```
7676

77-
You can also suppress compiler warnings by using [#pragma warning](../preprocessor-directives/preprocessor-pragma-warning.md) directives.
77+
You can also suppress compiler warnings by using [#pragma warning](../preprocessor-directives.md) directives.
7878

7979
## Example
8080

docs/csharp/language-reference/compiler-options/language.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The **DefineConstants** option defines symbols in all source code files of your
4949
<DefineConstants>name;name2</DefineConstants>
5050
```
5151

52-
This option specifies the names of one or more symbols that you want to define. The **DefineConstants** option has the same effect as the [#define](../preprocessor-directives/preprocessor-define.md) preprocessor directive except that the compiler option is in effect for all files in the project. A symbol remains defined in a source file until an [#undef](../preprocessor-directives/preprocessor-undef.md) directive in the source file removes the definition. When you use the `-define` option, an `#undef` directive in one file has no effect on other source code files in the project. You can use symbols created by this option with [#if](../preprocessor-directives/preprocessor-if.md), [#else](../preprocessor-directives/preprocessor-else.md), [#elif](../preprocessor-directives/preprocessor-elif.md), and [#endif](../preprocessor-directives/preprocessor-endif.md) to compile source files conditionally. The C# compiler itself defines no symbols or macros that you can use in your source code; all symbol definitions must be user-defined.
52+
This option specifies the names of one or more symbols that you want to define. The **DefineConstants** option has the same effect as the [#define](../preprocessor-directives.md) preprocessor directive except that the compiler option is in effect for all files in the project. A symbol remains defined in a source file until an [#undef](../preprocessor-directives.md) directive in the source file removes the definition. When you use the `-define` option, an `#undef` directive in one file has no effect on other source code files in the project. You can use symbols created by this option with [#if](../preprocessor-directives.md), [#else](../preprocessor-directives.md), [#elif](../preprocessor-directives.md), and [#endif](../preprocessor-directives.md) to compile source files conditionally. The C# compiler itself defines no symbols or macros that you can use in your source code; all symbol definitions must be user-defined.
5353

5454
> [!NOTE]
5555
> The C# `#define` directive does not allow a symbol to be given a value, as in languages such as C++. For example, `#define` cannot be used to create a macro or to define a constant. If you need to define a constant, use an `enum` variable. If you want to create a C++ style macro, consider alternatives such as generics. Since macros are notoriously error-prone, C# disallows their use but provides safer alternatives.
@@ -146,4 +146,4 @@ Invocation of methods annotated with the following attributes will also affect f
146146
> 1. Start the file name with *TemporaryGeneratedFile_*
147147
> 1. End the file name with *.designer.cs*, *.generated.cs*, *.g.cs*, or *.g.i.cs*.
148148
>
149-
> Generators can opt-in using the [`#nullable`](../preprocessor-directives/preprocessor-nullable.md) preprocessor directive.
149+
> Generators can opt-in using the [`#nullable`](../preprocessor-directives.md) preprocessor directive.

docs/csharp/language-reference/compiler-options/output.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The **DocumentationFile** option allows you to place documentation comments in a
3232
The source code file that contains Main or top-level statements is output first into the XML. You'll often want to use the generated .xml file with [IntelliSense](/visualstudio/ide/using-intellisense). The *.xml* filename must be the same as the assembly name. The *.xml* file must be in the same directory as the assembly. When the assembly is referenced in a Visual Studio project, the *.xml* file is found as well. For more information about generating code comments, see [Supplying Code Comments](/visualstudio/ide/reference/generate-xml-documentation-comments). Unless you compile with [`<TargetType:Module>`](#targettype), `file` will contain `<assembly>` and `</assembly>` tags specifying the name of the file containing the assembly manifest for the output file. For examples, see [How to use the XML documentation features](../../programming-guide/xmldoc/how-to-use-the-xml-documentation-features.md).
3333

3434
> [!NOTE]
35-
> The **DocumentationFile** option applies to all files in the project. To disable warnings related to documentation comments for a specific file or section of code, use [#pragma warning](../preprocessor-directives/preprocessor-pragma-warning.md).
35+
> The **DocumentationFile** option applies to all files in the project. To disable warnings related to documentation comments for a specific file or section of code, use [#pragma warning](../preprocessor-directives.md).
3636
3737
## OutputAssembly
3838

docs/csharp/language-reference/configure-language-version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ If you must specify your C# version explicitly, you can do so in several ways:
4848
- Configure the [**LangVersion** compiler option](compiler-options/language.md#langversion).
4949

5050
> [!TIP]
51-
> To know what language version you're currently using, put `#error version` (case sensitive) in your code. This makes the compiler report a compiler error, CS8304, with a message containing the compiler version being used and the current selected language version. See [#error (C# Reference)](preprocessor-directives/preprocessor-error.md) for more information.
51+
> To know what language version you're currently using, put `#error version` (case sensitive) in your code. This makes the compiler report a compiler error, CS8304, with a message containing the compiler version being used and the current selected language version. See [#error (C# Reference)](preprocessor-directives.md) for more information.
5252
5353
### Edit the project file
5454

0 commit comments

Comments
 (0)