-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
29 lines (25 loc) · 1.67 KB
/
Directory.Build.targets
File metadata and controls
29 lines (25 loc) · 1.67 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
<Project>
<PropertyGroup>
<!-- Default PKHeX source paths per OS; override with -p:PKHeXSourcePath=... -->
<PKHeXSourcePath Condition="'$(PKHeXSourcePath)' == '' And $([MSBuild]::IsOsPlatform('Windows'))">C:\Code\PKHeX\PKHeX.Core\PKHeX.Core.csproj</PKHeXSourcePath>
<PKHeXSourcePath Condition="'$(PKHeXSourcePath)' == ''">$(HOME)/Code/codemonkey85/PKHeX/PKHeX.Core/PKHeX.Core.csproj</PKHeXSourcePath>
</PropertyGroup>
<!-- Detect whether this project directly references PKHeX.Core so we only swap
projects that actually consume it. Without this guard the ItemGroup below
runs for every project that imports Directory.Build.targets, unnecessarily
coupling them to the local PKHeX checkout.
We build a sentinel-delimited string from the PackageReference identity list
and use a property function Contains check to avoid MSBuild restrictions on
built-in metadata (%(Identity)) in item element conditions (MSB4190). -->
<PropertyGroup Condition="'$(UseLocalPKHeX)' == 'true'">
<_PKHeXCoreSentinel>;@(PackageReference->'%(Identity)');</_PKHeXCoreSentinel>
<_HasPKHeXCoreRef Condition="$(_PKHeXCoreSentinel.Contains(';PKHeX.Core;'))">true</_HasPKHeXCoreRef>
</PropertyGroup>
<!-- Swap NuGet PKHeX.Core for a local project reference.
Usage: dotnet build ... -p:UseLocalPKHeX=true
Override path: -p:PKHeXSourcePath=/path/to/PKHeX.Core.csproj -->
<ItemGroup Condition="'$(UseLocalPKHeX)' == 'true' And '$(_HasPKHeXCoreRef)' == 'true'">
<PackageReference Remove="PKHeX.Core"/>
<ProjectReference Include="$(PKHeXSourcePath)"/>
</ItemGroup>
</Project>