Repository navigation
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
110 lines (96 loc) · 6.89 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
110 lines (96 loc) · 6.89 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
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Security remediation for GHSA-v5pm-xwqc-g5wc (uncontrolled recursion / stack overflow
when parsing OpenAPI documents with circular schema references).
Microsoft.AspNetCore.OpenApi 10.0.0 (net10.0) pulls in the vulnerable Microsoft.OpenApi
2.0.0 transitively. With TreatWarningsAsErrors=true the NU1903 restore audit turns that
into a hard build break. Add a direct reference to the patched version (pinned per TFM
centrally in Directory.Packages.props: 2.x on net10.0, 3.x on net11.0) so it wins over the
transitive 2.0.0.
Scoped to projects that reference Microsoft.AspNetCore.OpenApi. Swashbuckle-only web apps
need no help: Swashbuckle 10 (net10.0) floors Microsoft.OpenApi at the patched 2.7.5 and
Swashbuckle 11 (net11.0) at 3.11.0 (GH-5149).
Non-web test projects that reference these web apps inherit the pin transitively.
-->
<ItemGroup Condition=" ('$(TargetFramework)' == 'net10.0' Or '$(TargetFramework)' == 'net11.0') And @(PackageReference->AnyHaveMetadataValue('Identity', 'Microsoft.AspNetCore.OpenApi')) ">
<PackageReference Include="Microsoft.OpenApi" />
</ItemGroup>
<!--
GH-5387 pinned Microsoft.DotNet.ILCompiler explicitly here (9.0.22 / 10.0.14) because the SDKs of
the day named ILCompiler packs inside GHSA-p3jp-9v83-76w9's range. That pin is gone again: with
the .NET 11 SDK on the box (global.json rolls forward to it), the SDK resolves the NativeAOT
runtime pack at ITS known version (10.0.15 for net10.0) while the explicit reference held the
compiler targets at 10.0.14, and the mismatch fails every PublishAot with "The PrivateSdkAssemblies
ItemGroup is required for _ComputeAssembliesToCompileToNative" (wolverine#5467's first CI run on
net11.0). Every SDK the repo builds with now names a patched compiler (10.0.14+, 11.0.0), so the
implicit pack is both safe and the only version that cannot skew.
-->
<!--
Every test process builds hundreds of hosts, and Host.CreateDefaultBuilder() attaches a
FileSystemWatcher to the content root for each one. See src/DisableConfigReloadInTests.cs for
the mechanics and the numbers. Linked in from here rather than per-project so a new test
project cannot silently reintroduce the leak.
Keyed on IsTestProject, which Microsoft.NET.Test.Sdk sets for us, rather than on the project
name: eight suites here do not end in "Tests" (the six *.LeaderElection projects,
EfCoreTests.MultiTenancy, ChaosTesting) and a name test quietly skips every one of them.
It also excludes Wolverine.ComplianceTests, which ships as WolverineFx.ComplianceTests — a
module initializer that mutates process environment variables has no business inside a
published package.
This lives in Directory.Build.targets and not .props because .props is imported before the
project body and before the NuGet-generated props, so IsTestProject is not set yet there.
Do NOT reach for '$(PackageId)' == '' as the package guard: PackageId defaults to the assembly
name, so that condition is false for every project and silently compiles nothing — while the
build still reports success.
-->
<ItemGroup Condition=" '$(IsTestProject)' == 'true' ">
<Compile Include="$(MSBuildThisFileDirectory)src/DisableConfigReloadInTests.cs">
<Link>DisableConfigReloadInTests.cs</Link>
</Compile>
</ItemGroup>
<!--
GH-5057. The Microsoft.Testing.Platform entry point (see the name-keyed rule in
Directory.Build.props) for the test projects whose names do not end in "Tests": the same
eight listed above. Without it those executables were built around xUnit's own console
runner, so `dotnet test` and xUnit's filter-class option refused them and only the classic
`-class` switch worked.
Keyed on IsTestProject for the same reason as the item group above, and safe to set this
late: xunit.v3.core.mtp-v2 reads UseMicrosoftTestingPlatformRunner only inside its
entry-point generation targets, never at evaluation time.
-->
<PropertyGroup Condition=" '$(IsTestProject)' == 'true' ">
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>
<!--
GH-5403. Runs Wolverine's own analyzers (src/Wolverine.Analyzers, the WolverineFx.Analyzers package) over
every C# project in the repository, so the code here is held to the same warnings a WolverineFx consumer
gets. A ProjectReference does not pass an analyzer on to the projects that reference it, so it is added to
each project here. Wolverine.csproj declares its own (it is the one that makes the package depend on it),
and PrivateAssets="all" keeps every other package from depending on WolverineFx.Analyzers.
Build with -p:WolverineAnalyzers=false to leave them out.
-->
<ItemGroup Condition=" '$(MSBuildProjectExtension)' == '.csproj' And '$(WolverineAnalyzers)' != 'false' And '$(MSBuildProjectName)' != 'Wolverine' And '$(MSBuildProjectName)' != 'Wolverine.Analyzers' And Exists('$(MSBuildThisFileDirectory)src/Wolverine.Analyzers/Wolverine.Analyzers.csproj') ">
<ProjectReference Include="$(MSBuildThisFileDirectory)src/Wolverine.Analyzers/Wolverine.Analyzers.csproj"
OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all"
IsAspireProjectResource="false" />
</ItemGroup>
<!--
wolverine.slnx and wolverine_slim.slnx carry the analyzer project with Build Project="false", so the pinned
solution build never makes a net10.0 instance of it. A solution build drops every reference to a project the
solution does not build, unless this is false: without it the references above never built the analyzer, the
projects compiled without it, and CoreTests (which references the built assembly by path) failed in a fresh
checkout. build/build.csproj is the only other project with Build="false", and nothing references it.
-->
<PropertyGroup>
<OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration>false</OnlyReferenceAndBuildProjectsEnabledInSolutionConfiguration>
</PropertyGroup>
<!--
GH-5624. The sample AppHosts declare a one-entry <TargetFrameworks> (GH-5622), which gives them an outer build,
and the Aspire AppHost SDK picks the dashboard and DCP runtime identifier in Restore, in that outer build, with
the .NET SDK's in-process PickBestRid task. The SDK only declares that task for an inner build, so the outer
build fails with MSB4036. Outside an inner build, use the SDK's own out-of-process fallback instead.
-->
<PropertyGroup Condition=" '$(IsAspireHost)' == 'true' And '$(TargetFramework)' == '' ">
<_AspireUseSdkPickBestRid>false</_AspireUseSdkPickBestRid>
</PropertyGroup>
</Project>