-
Notifications
You must be signed in to change notification settings - Fork 691
/
Uno.Common.WinAppSdk.targets
77 lines (63 loc) · 4.12 KB
/
Uno.Common.WinAppSdk.targets
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
<Project>
<PropertyGroup>
<IsWinAppSdk>true</IsWinAppSdk>
<UseRidGraph>true</UseRidGraph>
<TargetPlatformMinVersion Condition=" $(TargetPlatformMinVersion) == '' ">10.0.18362.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition=" $(SupportedOSPlatformVersion) == '' ">$(TargetPlatformMinVersion)</SupportedOSPlatformVersion>
<!-- Set EnableMsixTooling to true only for executables - setting this on class libraries prevents assets from being correctly copied to windows target -->
<EnableMsixTooling Condition=" $(EnableMsixTooling) == '' AND ('$(OutputType)' == 'WinExe' OR '$(OutputType)' == 'Exe') ">true</EnableMsixTooling>
<EnableWindowsTargeting Condition=" $(EnableWindowsTargeting) == '' ">true</EnableWindowsTargeting>
<EnableDefaultWindowsItems Condition="$(EnableDefaultWindowsItems) == ''">false</EnableDefaultWindowsItems>
<!-- Required to override the `win10-xxx` identifiers that cannot work with class libraries -->
<RuntimeIdentifiers Condition="'$(RuntimeIdentifiers)'==''">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition=" $(_IsExecutable) == 'true' ">
<!-- Set EnableMsixTooling to true only for executables - setting this on class libraries prevents assets from being correctly copied to windows target -->
<EnableMsixTooling Condition=" $(EnableMsixTooling) == '' ">true</EnableMsixTooling>
</PropertyGroup>
<PropertyGroup>
<!-- Workaround Uno Issue 15492 - This must be set to true for the Library so that the generated files use the Library name in the path -->
<EnableCoreMrtTooling Condition=" $(EnableCoreMrtTooling) == '' AND !$(_IsExecutable) AND '$(MSBuildRuntimeType)' != 'Core'">true</EnableCoreMrtTooling>
<!--
This change provides the ability to use `dotnet build` but this can only work for the head
projects, not libraries.
Related to https://github.com/microsoft/WindowsAppSDK/issues/3548
-->
<EnableCoreMrtTooling Condition=" $(EnableCoreMrtTooling) == '' AND '$(MSBuildRuntimeType)' == 'Core' ">false</EnableCoreMrtTooling>
</PropertyGroup>
<PropertyGroup Condition=" $(_IsUnoSingleProjectAndLegacy) != 'true' AND $(_IsExecutable) == 'true'">
<ApplicationManifest Condition=" $(ApplicationManifest) == '' ">app.manifest</ApplicationManifest>
<Platforms Condition=" $(Platforms) == '' ">x86;x64;arm64</Platforms>
<Platform Condition="$(Platform) == 'AnyCPU'">$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</Platform>
<PublishProfile Condition=" $(PublishProfile) == '' ">win-$(Platform).pubxml</PublishProfile>
<UseWinUI Condition=" $(UseWinUI) == '' ">true</UseWinUI>
</PropertyGroup>
<!-- Legacy Project Support -->
<ItemGroup Condition=" $(_IsUnoSingleProjectAndLegacy) != 'true' AND $(_IsExecutable) == 'true' ">
<!-- Exclude Manifest items that have already been added to avoid duplicates -->
<Manifest Include="$(ApplicationManifest)" Exclude="@(Manifest)" />
</ItemGroup>
<ItemGroup>
<!-- Replicates the original globbing from WinAppSDK (See microsoft.windowsappsdk\1.4.240211001\buildTransitive\Microsoft.WinUI.props)-->
<Content Update="Assets/**/*.*" Condition="'$(EnableDefaultAssets)'=='true'">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<!-- Workaround to avoid including Project XBFs in the PRI file: https://github.com/microsoft/microsoft-ui-xaml/issues/8857 -->
<Import Project="winappsdk-workaround.targets"
Condition=" $(_IsUnoSingleProjectAndLegacy) != 'true' and '$(DisableWinUI8857_Workaround)' != 'true' "/>
<Import Project="Uno.SingleProject.WinAppSdk.targets"
Condition=" $(_IsUnoSingleProjectAndLegacy) == 'true' " />
<Target Name="_UnoValidateWinAppSDK3548"
BeforeTargets="BeforeBuild"
Condition="
'$(UnoDisableValidateWinAppSDK3548)' != 'true'
AND $(EnableCoreMrtTooling) == 'false'
AND !$(_IsExecutable)
AND '$(MSBuildRuntimeType)' == 'Core'
AND '@(Page)' != '' ">
<Error Code="UNOB0008"
HelpLink="https://aka.platform.uno/UNOB0008"
Text="Building a WinUI class library with dotnet build is not supported when XAML files are present. Use `msbuild` instead." />
</Target>
</Project>