-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
241 lines (213 loc) · 15.5 KB
/
Copy pathDirectory.Build.props
File metadata and controls
241 lines (213 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Set common MSBuild properties and item metadata for CsWinRT tool and tests -->
<PropertyGroup Label="Globals">
<MinimalCoreWin>true</MinimalCoreWin>
<VCProjectVersion>15.0</VCProjectVersion>
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<CppWinRTVerbosity>high</CppWinRTVerbosity>
<CsWinRTVerbosity>high</CsWinRTVerbosity>
<MicrosoftWinAppSDKWinUIVersion>1.8.251105000</MicrosoftWinAppSDKWinUIVersion>
<MicrosoftWinAppSDKIxpVersion>1.8.251104001</MicrosoftWinAppSDKIxpVersion>
<MicrosoftWinAppSDKFoundationVersion>1.8.251104000</MicrosoftWinAppSDKFoundationVersion>
<MicrosoftWebWebView2Version>1.0.3179.45</MicrosoftWebWebView2Version>
<!-- Debug symbol properties -->
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<GenerateTestProjection Condition="'$(GenerateTestProjection)$(Configuration)' == 'Release'">true</GenerateTestProjection>
<GenerateTestProjection Condition="'$(GenerateTestProjection)' == ''">false</GenerateTestProjection>
<CsWinRTGenerateProjection>$(GenerateTestProjection)</CsWinRTGenerateProjection>
<CsWinRTWindowsMetadata Condition="'$(CsWinRTWindowsMetadata)' == ''">$(WindowsSDKVersion.TrimEnd('\'))</CsWinRTWindowsMetadata>
<CsWinRTWindowsMetadata Condition="'$(CsWinRTWindowsMetadata)' == ''">sdk</CsWinRTWindowsMetadata>
<PlatformToolset>v143</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<AssetTargetFallback>netcoreapp5.0</AssetTargetFallback>
<IsTargetFrameworkNet5OrGreater>true</IsTargetFrameworkNet5OrGreater>
<IsTargetFrameworkNet8OrGreater>true</IsTargetFrameworkNet8OrGreater>
<AppBuildTFMs>net10.0</AppBuildTFMs>
<AppBuildTFMs Condition="'$(CIBuildReason)' == 'CI'">net10.0</AppBuildTFMs>
<LibBuildTFMs>net10.0</LibBuildTFMs>
<LibBuildTFMs Condition="'$(CIBuildReason)' == 'CI'">net10.0</LibBuildTFMs>
<TestsBuildTFMs>net10.0-windows10.0.19041.0</TestsBuildTFMs>
<TestsBuildTFMs Condition="'$(CIBuildReason)' == 'CI'">net10.0-windows10.0.19041.0</TestsBuildTFMs>
<FunctionalTestsBuildTFMs>net10.0</FunctionalTestsBuildTFMs>
<WindowsAppSDKVerifyWinrtRuntimeVersion>false</WindowsAppSDKVerifyWinrtRuntimeVersion>
<CsWinRTMessageImportance>high</CsWinRTMessageImportance>
</PropertyGroup>
<PropertyGroup Label="Globals" Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<!--
Classify "public" (product) projects, ie. the ones we actually ship, which are all named with a 'WinRT.'
prefix. This is used below to scope the repo's strict analysis (code-style enforcement and XML documentation)
to just those projects, leaving non-product projects (tests, samples, benchmarks, the local projection
projects, etc.) out of it. Note: 'StartsWith(...)' returns 'true'/'false', so compare against 'true' below.
-->
<IsPublicProject>$(MSBuildProjectName.StartsWith('WinRT.'))</IsPublicProject>
<!--
Centralize the .NET version used by all projects. This makes it much easier to try out different
.NET versions without touching every project file, as well as reverting any changes, if needed.
-->
<DotNetVersion>net10.0</DotNetVersion>
<!-- Enforce the same language version for all projects -->
<LangVersion>14.0</LangVersion>
<!-- Allow unsafe code in all projects (the runtime and build tools rely heavily on pointers and other unsafe constructs for interop) -->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!--
Treat all warnings as errors, only in release configurations. This allows the dev inner loop to remain
convenient, without errors while testing things out and prototyping things, while still ensuring that
all CI runs and official builds (including from PRs) will fail if any warnings are not addressed.
-->
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
<CodeAnalysisTreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</CodeAnalysisTreatWarningsAsErrors>
<!--
Enable the latest warning wave, which shows additional warnings for invalid language features that are disabled by default.
For additional info, see https://docs.microsoft.com/dotnet/csharp/language-reference/compiler-messages/warning-waves.
-->
<AnalysisLevel>latest</AnalysisLevel>
<!--
Enable all IDExxxx code-style rules and enforce them during build, but only for the public (product) projects.
We don't want to impose the repo's strict code-style rules on non-product projects (tests, samples, benchmarks,
the local projection projects, etc.): they would surface a large number of non-actionable IDExxxx warnings (and
'EnableGenerateDocumentationFile' from IDE0005, which requires docs to be generated) on code we don't ship,
including generated projection code.
-->
<AnalysisLevelStyle Condition="'$(IsPublicProject)' == 'true'">latest-all</AnalysisLevelStyle>
<EnforceCodeStyleInBuild Condition="'$(IsPublicProject)' == 'true'">true</EnforceCodeStyleInBuild>
<!--
Suppress ref safety warnings in unsafe contexts (see https://github.com/dotnet/csharplang/issues/6476).
This is used eg. to replace Unsafe.SizeOf<T>() calls with just sizeof(T), or to just use raw pointers to
reinterpret references to managed objects when it is safe to do so. The warnings are not necessary in this
context, since in order to use these APIs the caller already has to be in an unsafe context.
-->
<NoWarn>$(NoWarn);CS8500</NoWarn>
<!--
Temporarily suppress warnings about using CsWinRT 3.0 while in preview:
NETSDK1229: "Targeting a Windows SDK version with '1' as the revision number will reference CsWinRT 3.0, which is
currently in preview. The current project is targeting the Windows SDK version ''. If this is not intended, change
the revision number to '0' to use CsWinRT 2.x instead.".
-->
<NoWarn>$(NoWarn);NETSDK1229</NoWarn>
<!--
Enable the compiler strict mode (see https://www.meziantou.net/csharp-compiler-strict-mode.htm).
This (poorly documented) mode enables additional warnings for incorrect usages of some features.
For instance, this will warn when using the == operator to compare a struct with a null literal.
-->
<Features>$(Features);strict</Features>
<!--
Generate documentation files, but only for the public (product) projects. We don't care about XML docs for
non-product projects (tests, samples, benchmarks, the local projection projects, etc.), and enabling it there
would also enforce 'CS1591' on all their public members and on generated projection code, which isn't actionable.
In theory this should only be enabled for published, non source generator projects. However, it's enabled for
all product projects (including the source generator) to work around https://github.com/dotnet/roslyn/issues/41640.
Until that's fixed, source generators will also produce an .xml file with their documentation. Note that this
doesn't really impact NuGet packages, since the analyzer binaries are packed manually after build, so the .xml
files aren't included. Once that issue is fixed, this should be restricted to published projects only.
-->
<GenerateDocumentationFile Condition="'$(IsPublicProject)' == 'true'">true</GenerateDocumentationFile>
</PropertyGroup>
<!-- Set overrides to point to folder where they are built in solution -->
<PropertyGroup>
<CsWinRTGenTasksAssembly>$(MSBuildThisFileDirectory)WinRT.Generator.Tasks\bin\$(Configuration)\netstandard2.0\WinRT.Generator.Tasks.dll</CsWinRTGenTasksAssembly>
<_CsWinRTToolsArchFolder Condition="'$(BuildToolArch)' != ''">win-$(BuildToolArch)\</_CsWinRTToolsArchFolder>
<CsWinRTInteropGenEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.Interop.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTInteropGenEffectiveToolsDirectory>
<CsWinRTImplEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.Impl.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTImplEffectiveToolsDirectory>
<CsWinRTMergedProjectionEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.Projection.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTMergedProjectionEffectiveToolsDirectory>
<CsWinRTRefGenEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.Projection.Ref.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTRefGenEffectiveToolsDirectory>
<CsWinRTWinMDGenEffectiveToolsDirectory>$(MSBuildThisFileDirectory)WinRT.WinMD.Generator\bin\$(Configuration)\net10.0\$(_CsWinRTToolsArchFolder)</CsWinRTWinMDGenEffectiveToolsDirectory>
<CsWinRTToolsArchitecture>AnyCPU</CsWinRTToolsArchitecture>
</PropertyGroup>
<PropertyGroup>
<VersionNumber Condition="'$(VersionNumber)'==''">0.0.0.0</VersionNumber>
<VersionString Condition="'$(VersionString)'==''">0.0.0-private.0</VersionString>
<!--
Default 'AssemblyVersionNumber' to '3.0.0.0' (the 'WinRT.Runtime' CsWinRT 3.0 baseline) so
that 'dotnet build' from the repo root works without explicit '/p:AssemblyVersionNumber=...'.
Official builds set this explicitly via the 'CsWinRT-Variables' pipeline.
-->
<AssemblyVersionNumber Condition="'$(AssemblyVersionNumber)' == ''">3.0.0.0</AssemblyVersionNumber>
<BuildPlatform>$(Platform)</BuildPlatform>
<BuildPlatform Condition="'$(Platform)'=='Win32'">x86</BuildPlatform>
<BuildOutDir Condition="'$(BuildOutDir)'==''">$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)_build', '$(BuildPlatform)', '$(Configuration)'))</BuildOutDir>
<!--
The 'WindowsRuntime.Internal.winmd' metadata used to bind the Windows SDK interop
interfaces (e.g. 'IPrintManagerInterop', 'IDragDropManagerInterop') is produced by
the managed 'WinRT.Internal' project, which targets the TFM below.
-->
<CsWinRTInternalTargetFramework Condition="'$(CsWinRTInternalTargetFramework)' == ''">net10.0-windows10.0.26100.1</CsWinRTInternalTargetFramework>
<CsWinRTInteropMetadata Condition="'$(CsWinRTInteropMetadata)' == ''">$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', 'WinRT.Internal', 'bin', '$(Configuration)', '$(CsWinRTInternalTargetFramework)', 'WindowsRuntime.Internal.winmd'))</CsWinRTInteropMetadata>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.vcxproj' or '$(MSBuildProjectExtension)' == '.wapproj'">
<OutDir>$([MSBuild]::NormalizeDirectory('$(BuildOutDir)', '$(MSBuildProjectName)', 'bin'))</OutDir>
<IntDir>$([MSBuild]::NormalizeDirectory('$(BuildOutDir)', '$(MSBuildProjectName)', 'obj'))</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<!-- Hash algorithm for file checksums in debug info -->
<ChecksumAlgorithm>SHA256</ChecksumAlgorithm>
<!-- Set remote for source link. -->
<AdoMirrorBuild Condition="'$(AdoMirrorBuild)' == ''">false</AdoMirrorBuild>
<GitRepositoryRemoteName Condition="$(AdoMirrorBuild)">github</GitRepositoryRemoteName>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Tells NativeAOT to not ignore issues where assemblies / types fail to be resolved. -->
<IlcResilient>false</IlcResilient>
</PropertyGroup>
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>VERSION_NUMBER="$(VersionNumber)";VERSION_STRING="$(VersionString)";NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
</ClCompile>
<ClCompile Condition="'$(Configuration)'=='Debug'">
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Condition="'$(Configuration)'=='Release'">
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization >MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<ClCompile Condition="'$(MSBuildProjectExtension)' == '.vcxproj' or '$(MSBuildProjectExtension)' == '.wapproj'">
<ControlFlowGuard Condition="'$(Configuration)'=='Release'">Guard</ControlFlowGuard>
<!-- /Qspectre Specifies compiler generation of instructions to mitigate certain Spectre variant 1 security vulnerabilities. BinSkim asks for this. -->
<!-- /ZH:SHA_256 Hash algorithm for file checksums in debug info -->
<!-- /guard:cast /d2CastGuardFailureMode:fastfail Mitigates type confusion via unsafe static downcasts. BinSkim asks for this.
Requires non-incremental LTCG (LinkTimeCodeGeneration=UseLinkTimeCodeGeneration). -->
<AdditionalOptions>%(AdditionalOptions) /Qspectre /ZH:SHA_256</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)'=='Release'">%(AdditionalOptions) /guard:cast /d2CastGuardFailureMode:fastfail</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
</Link>
<Link Condition="'$(Configuration)'=='Release' and ('$(MSBuildProjectExtension)' == '.vcxproj' or '$(MSBuildProjectExtension)' == '.wapproj')">
<!-- /Brepro Enables deterministic output from the compiler toolchain -->
<!-- /PDBALTPATH Stops pdb's basepath from appearing in the Debug Directories of the image header -->
<!-- /CETCOMPAT enables Control-flow Enforcement Technology (CET) Shadow Stack mitigation.
BinSkim asks for this. /CETCOMPAT does not support arm64. -->
<AdditionalOptions Condition="'$(Platform)' == 'arm64'">%(AdditionalOptions) /Brepro /PDBALTPATH:$(TargetName).pdb</AdditionalOptions>
<AdditionalOptions Condition="'$(Platform)' != 'arm64'">%(AdditionalOptions) /Brepro /PDBALTPATH:$(TargetName).pdb /CETCOMPAT</AdditionalOptions>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>VERSION_NUMBER=\"$(VersionNumber)\";VERSION_COMMAS=$(VersionNumber.Replace('.', ','));FILE_DESCRIPTION=\"C#/WinRT v$(VersionString)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
<Import Project="Strings.props" />
<Import Condition="'$(MSBuildProjectExtension)' == '.csproj' and '$(SimulateCsWinRTNugetReference)' == 'true'" Project="..\nuget\Microsoft.Windows.CsWinRT.props" />
</Project>