-
Notifications
You must be signed in to change notification settings - Fork 326
/
Copy pathDirectory.Build.props
151 lines (134 loc) · 8.17 KB
/
Directory.Build.props
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
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="$(RepositoryEngineeringDir)Analyzers.props" />
<PropertyGroup>
<RepoRoot Condition=" '$(RepoRoot)' == '' ">$([MSBuild]::NormalizeDirectory('$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'LICENSE'))'))</RepoRoot>
<IsSourceFile>false</IsSourceFile>
<IsSourceFile Condition="$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectFullPath)).StartsWith('src/')) OR $([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectFullPath)).StartsWith('src\'))">true</IsSourceFile>
<SrcPackageFolder>$(RepoRoot)src\package\</SrcPackageFolder>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<!--
This version is read by vsts-prebuild.ps1 and is a base for the current version, this should be updated at the start of
new iteration to the goal number. This is also used to version the local packages. This version needs to be statically
readable when we read the file as xml, don't move it to a .props file, unless you change the build server process
-->
<TPVersionPrefix>17.10.0</TPVersionPrefix>
<!--
Versioning is defined from the build script. Use a default dev build if it's not defined.
Sets the AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion
-->
<Version Condition="'$(Version)' == ''">$(TPVersionPrefix)-dev</Version>
<!-- Override the AssemblyVersion as 15.0.0 since protocol depends on this version for serialization. This is also defined in build script. -->
<AssemblyVersion Condition="'$(AssemblyVersion)' == ''">15.0.0</AssemblyVersion>
<!-- Auto generating binding redirects breaks testhost when running under net8.0 vstest.console as .NET Framework net462. -->
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<!-- But not autogenerating binding redirects also breaks build occasionally, so we tell MSBuild to unify assembly versions,
without outputting binding redirectes. -->
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
</PropertyGroup>
<!-- Language configuration -->
<PropertyGroup>
<!-- default to allowing all language features -->
<LangVersion>preview</LangVersion>
<!-- enable strict mode for Roslyn compiler -->
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<!-- default to max warnlevel -->
<AnalysisLevel>preview</AnalysisLevel>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CA1416;RS0037</NoWarn>
</PropertyGroup>
<!-- The TFMs to build and test against. -->
<PropertyGroup>
<!-- Naming is based on dotnet/runtime one -->
<NetFrameworkMinimum>net462</NetFrameworkMinimum>
<NetCoreAppMinimum>net8.0</NetCoreAppMinimum>
<NetCoreAppStable>net9.0</NetCoreAppStable>
<!--
Arcade is making things hard to work with. This property is unset when its value is equal to NetMinimum.
https://github.com/dotnet/arcade/blob/66c9c5397d599af40f2a94989241944f5a73442a/src/Microsoft.DotNet.Arcade.Sdk/tools/TargetFrameworkDefaults.props#L16-L18
Because I don't want to complexify further the logic on VSTest just for that, I will set it to NetMinimum.
-->
<NetPrevious Condition=" $(NetPrevious) == '' ">$(NetMinimum)</NetPrevious>
<!--
vstest.console.exe is shipped with VS, we can use the version of .NET Framework that VS requires to run (this might differ from the version is requires to install).
https://learn.microsoft.com/en-us/visualstudio/releases/2022/system-requirements#additional-requirements-and-guidance
-->
<NetFrameworkRunnerTargetFramework>net48</NetFrameworkRunnerTargetFramework>
<!--
vstest.console.dll or datacollector.dll are shipped with .NET SDK, target the tfms into which we insert.
-->
<NetSDKTargetFramework>$(NetCoreAppStable)</NetSDKTargetFramework>
<!--
vstest.console.dll and datacollector.dll are shipped in TestPlatform.Portable package, that should support
the oldest currently supported .NET, because we don't know with which runtime it will be used.
vstest.console.exe and datacollector.exe are shipped in there as well, choose the lowest version of
.NET Frameowork to support as well.
-->
<NetPortableTargetFrameworks>$(NetCoreAppMinimum)</NetPortableTargetFrameworks>
<NetRunnerTargetFrameworks>$(NetSDKTargetFramework);$(NetPortableTargetFrameworks)</NetRunnerTargetFrameworks>
<RunnerTargetFrameworks>$(NetFrameworkRunnerTargetFramework);$(NetRunnerTargetFrameworks)</RunnerTargetFrameworks>
<!--
-->
<BundledExtensionTargetFrameworks>$(RunnerTargetFrameworks)</BundledExtensionTargetFrameworks>
<!--
Extensions that are shipped as standalone packages need to be netstandard2.0, because we don't know on which runtime
we will run.
This is the same for bundled extensions that are shipped together with vstest.console or datacollector. In ideal case
they would not need netstandard, but we load the same dll into .NET and .NET Framework datacollector.
So the need to target netstandard2.0 as well.
-->
<ExtensionTargetFrameworks>netstandard2.0</ExtensionTargetFrameworks>
<!--
Testhosts need to run on all currently supported target frameworks and newer.
https://learn.microsoft.com/en-us/visualstudio/releases/2022/compatibility#-visual-studio-2022-support-for-net-development
https://dotnet.microsoft.com/en-us/platform/support/policy
https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-framework
Currently that is net8 (until November 10, 2026) and .NET Framework 4.6.2 (until Jan 12, 2027).
-->
<TestHostMinimumTargetFrameworks>$(NetCoreAppMinimum);$(NetFrameworkMinimum)</TestHostMinimumTargetFrameworks>
<!--
Testhost needs to support every target framework from the minimum, and it also needs to build
all the .NET Framework target frameworks that are newer than the minimum, because we ship each of those
executables separately, and use it to load dlls into specific version of .NET Framework based on user
settings.
https://learn.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-frameworks
-->
<TestHostAllTargetFrameworks>$(TestHostMinimumTargetFrameworks);net47;net471;net472;net48;net481</TestHostAllTargetFrameworks>
<!--
Library that is loaded by others and by us. We don't know where it will run (e.b. TranslationLayer),
we need to support all frameworks from minimum, and also netstandard2.0.
-->
<LibraryTargetFrameworks>$(NetFrameworkMinimum);netstandard2.0</LibraryTargetFrameworks>
</PropertyGroup>
<!-- Build & pack config -->
<PropertyGroup>
<Copyright>$(CopyrightMicrosoft)</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<!-- Prevent warning about deprecated target frameworks -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<DefineConstants Condition=" '$(DotNetBuildSourceOnly)' == 'true' ">$(DefineConstants);DOTNET_BUILD_FROM_SOURCE</DefineConstants>
<!-- PDB -->
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<!-- Default to all packages generating a corresponding symbol package -->
<IncludeSymbols>true</IncludeSymbols>
<!-- Workaround for AD0001 in analyzers with .NET 9. See https://github.com/dotnet/arcade/issues/14311 -->
<BuildWithNetFrameworkHostedCompiler>true</BuildWithNetFrameworkHostedCompiler>
</PropertyGroup>
<!-- Sign config -->
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>
<!-- Test config -->
<PropertyGroup>
<TestRunnerName>MSTest</TestRunnerName>
<!-- Skip windows only tests on non-windows systems. -->
<TestRunnerAdditionalArguments Condition=" '$(OS)' != 'Windows_NT' ">$(TestRunnerAdditionalArguments) --filter "TestCategory!=Windows&TestCategory!=Windows-Review"</TestRunnerAdditionalArguments>
</PropertyGroup>
</Project>