Skip to content

Commit b313633

Browse files
authored
Add three new properties (#31967)
1 parent 674fd72 commit b313633

File tree

3 files changed

+48
-11
lines changed

3 files changed

+48
-11
lines changed

docs/core/project-sdk/msbuild-props.md

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: MSBuild properties for Microsoft.NET.Sdk
33
description: Reference for the MSBuild properties and items that are understood by the .NET SDK.
4-
ms.date: 05/24/2022
4+
ms.date: 10/21/2022
55
ms.topic: reference
66
ms.custom: updateeachrelease
77
---
@@ -462,6 +462,7 @@ The following MSBuild properties are documented in this section:
462462
- [DocumentationFile](#documentationfile)
463463
- [EmbeddedResourceUseDependentUponConvention](#embeddedresourceusedependentuponconvention)
464464
- [EnablePreviewFeatures](#enablepreviewfeatures)
465+
- [EnableWindowsTargeting](#enablewindowstargeting)
465466
- [GenerateDocumentationFile](#generatedocumentationfile)
466467
- [GenerateRequiresPreviewFeaturesAttribute](#generaterequirespreviewfeaturesattribute)
467468
- [OptimizeImplicitlyTriggeredBuild](#optimizeimplicitlytriggeredbuild)
@@ -484,21 +485,21 @@ This property was introduced in .NET SDK 7.0.100, though it defaults to not bein
484485

485486
The `DisableImplicitFrameworkDefines` property controls whether or not the SDK generates preprocessor symbols for the target framework and platform for the .NET project. When this property is set to `false` or is unset (which is the default value) preprocessor symbols are generated for:
486487

487-
* Framework without version (`NETFRAMEWORK`, `NETSTANDARD`, `NET`)
488-
* Framework with version (`NET48`, `NETSTANDARD2_0`, `NET6_0`)
489-
* Framework with version minimum bound (`NET48_OR_GREATER`, `NETSTANDARD2_0_OR_GREATER`, `NET6_0_OR_GREATER`)
488+
- Framework without version (`NETFRAMEWORK`, `NETSTANDARD`, `NET`)
489+
- Framework with version (`NET48`, `NETSTANDARD2_0`, `NET6_0`)
490+
- Framework with version minimum bound (`NET48_OR_GREATER`, `NETSTANDARD2_0_OR_GREATER`, `NET6_0_OR_GREATER`)
490491

491492
For more information on target framework monikers and these implicit preprocessor symbols, see [Target frameworks](../../standard/frameworks.md).
492493

493494
Additionally, if you specify an operating system-specific target framework in the project (for example `net6.0-android`), the following preprocessor symbols are generated:
494495

495-
* Platform without version (`ANDROID`, `IOS`, `WINDOWS`)
496-
* Platform with version (`IOS15_1`)
497-
* Platform with version minimum bound (`IOS15_1_OR_GREATER`)
496+
- Platform without version (`ANDROID`, `IOS`, `WINDOWS`)
497+
- Platform with version (`IOS15_1`)
498+
- Platform with version minimum bound (`IOS15_1_OR_GREATER`)
498499

499500
For more information on operating system-specific target framework monikers, see [OS-specific TFMs](../../standard/frameworks.md#net-5-os-specific-tfms).
500501

501-
Finally, if your target framework implies support for older target frameworks, preprocessor symbols for those older frameworks are emitted. For example, `net6.0` **implies** support for `net5.0` and so on all the way back to `.netcoreapp1.0`. So for each of these target frameworks, the _Framework with version minimum bound_ symbol will be defined.
502+
Finally, if your target framework implies support for older target frameworks, preprocessor symbols for those older frameworks are emitted. For example, `net6.0` **implies** support for `net5.0` and so on all the way back to `.netcoreapp1.0`. So for each of these target frameworks, the *Framework with version minimum bound* symbol will be defined.
502503

503504
### DocumentationFile
504505

@@ -547,6 +548,16 @@ An analyzer warns if this attribute is present on dependencies for projects wher
547548

548549
Library authors who intend to ship preview assemblies should set this property to `True`. If an assembly needs to ship with a mixture of preview and non-preview APIs, see the [GenerateRequiresPreviewFeaturesAttribute](#generaterequirespreviewfeaturesattribute) section below.
549550

551+
### EnableWindowsTargeting
552+
553+
Set the `EnableWindowsTargeting` property to `true` to build Windows apps (for example, Windows Forms or Windows Presentation Foundation apps) on a non-Windows platform. If you don't set this property to `true`, you'll get build warning [NETSDK1100](../tools/sdk-errors/netsdk1100.md). This error occurs because targeting and runtime packs aren't automatically downloaded on platforms that aren't supported. By setting this property, those packs are downloaded when cross-targeting.
554+
555+
```xml
556+
<PropertyGroup>
557+
<EnableWindowsTargeting>true</EnableWindowsTargeting>
558+
</PropertyGroup>
559+
```
560+
550561
### GenerateDocumentationFile
551562

552563
The `GenerateDocumentationFile` property controls whether the compiler generates an XML documentation file for your library. If you set this property to `true` and you don't specify a file name via the [DocumentationFile property](#documentationfile), the generated XML file is placed in the same output directory as your assembly and has the same file name (but with an *.xml* extension).
@@ -976,14 +987,16 @@ The `TieredCompilationQuickJitForLoops` property configures whether the JIT comp
976987
</PropertyGroup>
977988
```
978989

979-
## Reference properties
990+
## Reference-related properties
980991

981992
The following MSBuild properties are documented in this section:
982993

983994
- [AssetTargetFallback](#assettargetfallback)
984995
- [DisableImplicitFrameworkReferences](#disableimplicitframeworkreferences)
996+
- [DisableTransitiveFrameworkReferenceDownloads](#disabletransitiveframeworkreferencedownloads)
985997
- [DisableTransitiveProjectReferences](#disabletransitiveprojectreferences)
986998
- [Restore-related properties](#restore-related-properties)
999+
- [UseMauiEssentials](#usemauiessentials)
9871000
- [ValidateExecutableReferencesMatchSelfContained](#validateexecutablereferencesmatchselfcontained)
9881001

9891002
### AssetTargetFallback
@@ -1010,6 +1023,16 @@ Set this property to `true` to disable implicit `FrameworkReference` or [Package
10101023
</PropertyGroup>
10111024
```
10121025

1026+
### DisableTransitiveFrameworkReferenceDownloads
1027+
1028+
Set the `DisableTransitiveFrameworkReferenceDownloads` property to `true` to avoid downloading extra runtime and targeting packs that aren't directly referenced by your project.
1029+
1030+
```xml
1031+
<PropertyGroup>
1032+
<DisableTransitiveFrameworkReferenceDownloads>true</DisableTransitiveFrameworkReferenceDownloads>
1033+
</PropertyGroup>
1034+
```
1035+
10131036
### DisableTransitiveProjectReferences
10141037

10151038
The `DisableTransitiveProjectReferences` property controls implicit project references. Set this property to `true` to disable implicit `ProjectReference` items. Disabling implicit project references results in non-transitive behavior similar to the [legacy project system](https://github.com/dotnet/project-system/blob/main/docs/feature-comparison.md).
@@ -1034,6 +1057,16 @@ Restoring a referenced package installs all of its direct dependencies and all t
10341057
</PropertyGroup>
10351058
```
10361059

1060+
### UseMauiEssentials
1061+
1062+
Set the `UseMauiEssentials` property to `true` to declare an explicit reference to a project or package that depends on MAUI Essentials. This setting ensures that your project pulls in the correct known framework reference for MAUI Essentials. If your project references a project that uses MAUI Essentials but you don't set this property to `true`, you might encounter build warning `NETSDK1186`.
1063+
1064+
```xml
1065+
<PropertyGroup>
1066+
<UseMauiEssentials>true</UseMauiEssentials>
1067+
</PropertyGroup>
1068+
```
1069+
10371070
### ValidateExecutableReferencesMatchSelfContained
10381071

10391072
The `ValidateExecutableReferencesMatchSelfContained` property can be used to disable errors related to executable project references. If .NET detects that a self-contained executable project references a framework-dependent executable project, or vice versa, it generates errors NETSDK1150 and NETSDK1151, respectively. To avoid these errors when the reference is intentional, set the `ValidateExecutableReferencesMatchSelfContained` property to `false`.

docs/core/tools/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ dotnet remove package Microsoft.EntityFrameworkCore
7070

7171
## See also
7272

73-
* [Package references in project files](../project-sdk/msbuild-props.md#reference-properties)
73+
* [Package references in project files](../project-sdk/msbuild-props.md#reference-related-properties)
7474
* [dotnet list package command](dotnet-list-package.md)

docs/core/tools/sdk-errors/netsdk1100.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ To resolve this error, set the `EnableWindowsTargeting` property to true. You ca
2626

2727
If you want to apply this setting to your whole solution or repository, you can set it in a *Directory.Build.props* file.
2828

29-
By default, .NET downloads all targeting packs (and runtime packs for self-contained builds) for the current target framework whether they're needed or not, because they might be brought in by a transitive framework reference. We didn't want to ship the Windows targeting packs with the non-Windows SDK builds, but we also didn't want a vanilla Console or ASP.NET Core app to automatically download these targeting and runtime packs the first time you build. The `EnableWindowsTargeting` property enables them to only be downloaded if you opt in.
29+
By default, .NET downloads all targeting packs (and runtime packs for self-contained builds) for the current target framework whether they're needed or not, because they might be brought in by a transitive framework reference. We didn't want to ship the Windows targeting packs with the non-Windows SDK builds, but we also didn't want a vanilla Console or ASP.NET Core app to automatically download these targeting and runtime packs the first time you build. The `EnableWindowsTargeting` property enables them to be downloaded only if you opt in.
30+
31+
## See also
32+
33+
- [EnableWindowsTargeting property](../../project-sdk/msbuild-props.md#enablewindowstargeting)

0 commit comments

Comments
 (0)