|
33 | 33 | <PublicKeyToken>35a561290d20de2f</PublicKeyToken> |
34 | 34 | </PropertyGroup> |
35 | 35 |
|
| 36 | + <PropertyGroup Condition=" '$(DotNetRoot)' == '' "> |
| 37 | + <DotNetRoot Condition=" '$(DOTNET_HOST_PATH)' != '' ">$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))</DotNetRoot> |
| 38 | + <DotNetRoot Condition=" '$(MSBuildRuntimeType)' != 'Core' ">$(ProgramFiles)\dotnet</DotNetRoot> |
| 39 | + </PropertyGroup> |
| 40 | + |
| 41 | + <ItemGroup Condition=" '$(DotNetRoot)' != '' "> |
| 42 | + <AndroidPackFolders Include="$(DotNetRoot)\packs\Microsoft.Android.Ref*" /> |
| 43 | + <IOSPackFolders Include="$(DotNetRoot)\packs\Microsoft.iOS.Ref*" /> |
| 44 | + <MacCatalystPackFolders Include="$(DotNetRoot)\packs\Microsoft.MacCatalyst.Ref*" /> |
| 45 | + <MacOSPackFolders Include="$(DotNetRoot)\packs\Microsoft.macOS.Ref*" /> |
| 46 | + </ItemGroup> |
| 47 | + |
| 48 | + <PropertyGroup> |
| 49 | + <AndroidPackPaths>@(AndroidPackFolders->'%(FullPath)')</AndroidPackPaths> |
| 50 | + <IOSPackPaths>@(IOSPackFolders->'%(FullPath)')</IOSPackPaths> |
| 51 | + <MacCatalystPackPaths>@(MacCatalystPackFolders->'%(FullPath)')</MacCatalystPackPaths> |
| 52 | + <MacOSPackPaths>@(MacOSPackFolders->'%(FullPath)')</MacOSPackPaths> |
| 53 | + </PropertyGroup> |
| 54 | + |
36 | 55 | <PropertyGroup> |
37 | 56 | <!-- |
38 | | - Note: targeting Android requires installing the .NET Android workload. To ensure the solution can |
39 | | - be built on machines that don't have the Android workload installed, a directory check is used to |
40 | | - ensure the Android reference assemblies pack is present on the machine before targeting Android. |
| 57 | + Note: targeting Android, iOS, Mac Catalyst or macOS requires installing the corresponding .NET workload. |
| 58 | + To ensure the solution can be built on machines that don't have the appropriate workloads installed, |
| 59 | + the platform-specific target framework monikers are only used if the corresponding .NET pack is present. |
41 | 60 | --> |
42 | 61 | <SupportsAndroidTargeting |
43 | 62 | Condition=" '$(SupportsAndroidTargeting)' == '' And |
44 | 63 | ($([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows())) And |
45 | | - ('$(GITHUB_ACTIONS)' == 'true' Or ('$(DotNetRoot)' != '' And Exists('$(DotNetRoot)packs\Microsoft.Android.Ref.34')) Or |
46 | | - ('$(DOTNET_HOST_PATH)' != '' And Exists('$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))\packs\Microsoft.Android.Ref.34')) Or |
47 | | - ('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.Android.Ref.34'))) ">true</SupportsAndroidTargeting> |
| 64 | + ('$(GITHUB_ACTIONS)' == 'true' Or '$(AndroidPackPaths)' != '') ">true</SupportsAndroidTargeting> |
48 | 65 |
|
49 | | - <!-- |
50 | | - Note: targeting iOS requires installing the .NET iOS workload. To ensure the solution can be |
51 | | - built on machines that don't have the iOS workload installed, a directory check is used to |
52 | | - ensure the iOS reference assemblies pack is present on the machine before targeting iOS. |
53 | | - --> |
54 | 66 | <SupportsIOSTargeting |
55 | 67 | Condition=" '$(SupportsIOSTargeting)' == '' And |
56 | 68 | ($([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows())) And |
57 | | - ('$(GITHUB_ACTIONS)' == 'true' Or ('$(DotNetRoot)' != '' And Exists('$(DotNetRoot)packs\Microsoft.iOS.Ref')) Or |
58 | | - ('$(DOTNET_HOST_PATH)' != '' And Exists('$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))\packs\Microsoft.iOS.Ref')) Or |
59 | | - ('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.iOS.Ref'))) ">true</SupportsIOSTargeting> |
60 | | - <!-- |
61 | | - Note: targeting Mac Catalyst requires installing the .NET Mac Catalyst workload. To ensure the solution |
62 | | - can be built on machines that don't have the Mac Catalyst workload installed, a directory check is used to |
63 | | - ensure the Mac Catalyst reference assemblies pack is present on the machine before targeting Mac Catalyst. |
64 | | - --> |
| 69 | + ('$(GITHUB_ACTIONS)' == 'true' Or '$(IOSPackPaths)' != '') ">true</SupportsIOSTargeting> |
| 70 | + |
65 | 71 | <SupportsMacCatalystTargeting |
66 | 72 | Condition=" '$(SupportsMacCatalystTargeting)' == '' And |
67 | 73 | ($([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows())) And |
68 | | - ('$(GITHUB_ACTIONS)' == 'true' Or ('$(DotNetRoot)' != '' And Exists('$(DotNetRoot)packs\Microsoft.MacCatalyst.Ref')) Or |
69 | | - ('$(DOTNET_HOST_PATH)' != '' And Exists('$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))\packs\Microsoft.MacCatalyst.Ref')) Or |
70 | | - ('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.MacCatalyst.Ref'))) ">true</SupportsMacCatalystTargeting> |
71 | | - <!-- |
72 | | - Note: targeting macOS requires installing the .NET macOS workload. To ensure the solution can be |
73 | | - built on machines that don't have the macOS workload installed, a directory check is used to |
74 | | - ensure the macOS reference assemblies pack is present on the machine before targeting macOS. |
75 | | - --> |
| 74 | + ('$(GITHUB_ACTIONS)' == 'true' Or '$(MacCatalystPackPaths)' != '') ">true</SupportsMacCatalystTargeting> |
| 75 | + |
76 | 76 | <SupportsMacOSTargeting |
77 | 77 | Condition=" '$(SupportsMacOSTargeting)' == '' And |
78 | 78 | ($([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows())) And |
79 | | - ('$(GITHUB_ACTIONS)' == 'true' Or ('$(DotNetRoot)' != '' And Exists('$(DotNetRoot)packs\Microsoft.macOS.Ref')) Or |
80 | | - ('$(DOTNET_HOST_PATH)' != '' And Exists('$([System.IO.Path]::GetDirectoryName($(DOTNET_HOST_PATH)))\packs\Microsoft.macOS.Ref')) Or |
81 | | - ('$(MSBuildRuntimeType)' != 'Core' And Exists('$(ProgramFiles)\dotnet\packs\Microsoft.macOS.Ref'))) ">true</SupportsMacOSTargeting> |
| 79 | + ('$(GITHUB_ACTIONS)' == 'true' Or '$(MacOSPackPaths)' != '') ">true</SupportsMacOSTargeting> |
82 | 80 |
|
83 | 81 | <!-- |
84 | 82 | Note: while <EnableWindowsTargeting>true</EnableWindowsTargeting> can be used to force targeting |
|
0 commit comments