Repository navigation
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
30 lines (27 loc) · 2.49 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
30 lines (27 loc) · 2.49 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
<Project>
<!--
Apple target frameworks cannot be built on Linux: the iOS, Mac Catalyst and macOS workloads do
not exist there, so restoring any multi-targeted project (and everything that references one,
such as samples/Sample.Linux) failed with NETSDK1178. Keep only the frameworks Linux can build (net10.0, -android, and -windows when forced).
This is evaluated after each project's own TargetFrameworks, so the projects keep listing what
they ship, and macOS/Windows are untouched.
The list is rebuilt from literal text on purpose. A string property function (Regex.Replace,
Replace, Trim) returns its result escaped, so the ';' came back as %3B and MSBuild ran ONE inner
build with TargetFramework='net10.0;net10.0-android' - "cannot be referenced by a project that
targets .NETCoreApp".
-->
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('linux')) And '$(TargetFrameworks)' != ''">
<_ShinyAllTfms>;$(TargetFrameworks);</_ShinyAllTfms>
<!-- Each entry appends when the list has something, or starts it when it is empty (the order of
each pair matters), so no leading ';' and no property function touches the result. -->
<_ShinyLinuxTfms></_ShinyLinuxTfms>
<_ShinyLinuxTfms Condition="$(_ShinyAllTfms.Contains(';$(BaseTargetFramework);'))">$(BaseTargetFramework)</_ShinyLinuxTfms>
<_ShinyLinuxTfms Condition="$(_ShinyAllTfms.Contains(';$(BaseTargetFramework)-android;')) And '$(_ShinyLinuxTfms)' != ''">$(_ShinyLinuxTfms);$(BaseTargetFramework)-android</_ShinyLinuxTfms>
<_ShinyLinuxTfms Condition="$(_ShinyAllTfms.Contains(';$(BaseTargetFramework)-android;')) And '$(_ShinyLinuxTfms)' == ''">$(BaseTargetFramework)-android</_ShinyLinuxTfms>
<!-- kept for the documented -p:ForceWindowsTfm=true compile check -->
<_ShinyLinuxTfms Condition="$(_ShinyAllTfms.Contains(';$(BaseTargetFramework)-windows10.0.19041.0;')) And '$(_ShinyLinuxTfms)' != ''">$(_ShinyLinuxTfms);$(BaseTargetFramework)-windows10.0.19041.0</_ShinyLinuxTfms>
<_ShinyLinuxTfms Condition="$(_ShinyAllTfms.Contains(';$(BaseTargetFramework)-windows10.0.19041.0;')) And '$(_ShinyLinuxTfms)' == ''">$(BaseTargetFramework)-windows10.0.19041.0</_ShinyLinuxTfms>
<!-- An Apple-only project keeps its list and fails on Linux, which is correct: it cannot build there. -->
<TargetFrameworks Condition="'$(_ShinyLinuxTfms)' != ''">$(_ShinyLinuxTfms)</TargetFrameworks>
</PropertyGroup>
</Project>