-
Notifications
You must be signed in to change notification settings - Fork 346
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
145 lines (128 loc) · 8.04 KB
/
Directory.Build.props
File metadata and controls
145 lines (128 loc) · 8.04 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
<?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>
<!-- When building the .NET product, there's no need to publish Windows PDBs. Any conversion to Windows PDBs will be done during staging, if necessary. -->
<PublishWindowsPdb Condition="'$(DotNetBuild)' == 'true'">false</PublishWindowsPdb>
</PropertyGroup>
<PropertyGroup>
<!-- 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>net10.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);$(NetCoreAppMinimum);netstandard2.0</LibraryTargetFrameworks>
</PropertyGroup>
<!-- Build & pack config -->
<PropertyGroup>
<Copyright>$(CopyrightMicrosoft)</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/microsoft/vstest</PackageProjectUrl>
<!-- 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>
</PropertyGroup>
<!-- Sign config -->
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>
<!-- Test config -->
<PropertyGroup>
<TestRunnerName>MSTest</TestRunnerName>
<!-- Avoid making the TestRunnerAdditionalArguments a global property that we cannot change in the run, by passing TestRunnerExternalArguments externally instead. -->
<TestRunnerAdditionalArguments Condition=" '$(TestRunnerExternalArguments)' != ''">$(TestRunnerExternalArguments)</TestRunnerAdditionalArguments>
<!-- Skip windows only tests on non-windows systems. -->
<TestRunnerAdditionalArguments Condition=" '$(OS)' != 'Windows_NT' ">$(TestRunnerAdditionalArguments) --filter "TestCategory!=Windows&TestCategory!=Windows-Review"</TestRunnerAdditionalArguments>
<!-- Allow us to see errors instead of capturing everything into files. -->
<TestCaptureOutput>false</TestCaptureOutput>
</PropertyGroup>
</Project>