-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
BundledVersions.in.targets
112 lines (96 loc) · 7.3 KB
/
BundledVersions.in.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
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
111
112
<Project>
<PropertyGroup>
<MauiWorkloadVersion>@VERSION@</MauiWorkloadVersion>
<MauiWorkloadTargetFramework>@TFM@</MauiWorkloadTargetFramework>
<MauiWorkloadTargetFrameworkVersion>@MAUI_DOTNET_VERSION@</MauiWorkloadTargetFrameworkVersion>
<MauiVersion Condition=" '$(MauiVersion)' == '' ">$(MauiWorkloadVersion)</MauiVersion>
<!--
Indicates that the Microsoft.Maui.Controls.Compatibility package should be implicitly
referenced. This will eventually switch to false by default and become opt, in,
however Visual Studio currently depends on this assembly being loaded for Live Visual Tree.
-->
<UseMauiCompat Condition=" '$(UseMauiCompat)' == '' and '$(UseMaui)' == 'true' ">false</UseMauiCompat>
<!--
If opted into NuGet Central Package Management, $(DisableMauiImplicitPackageReferences) defaults to true
https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management
-->
<DisableMauiImplicitPackageReferences Condition=" '$(ManagePackageVersionsCentrally)' == 'true' and '$(DisableMauiImplicitPackageReferences)' == '' ">true</DisableMauiImplicitPackageReferences>
</PropertyGroup>
<!-- .NET MAUI version for telemetry: this is the installed workload in use, not the final version in the app -->
<ItemGroup>
<ProjectCapability Include="Microsoft.Maui.Workload.Version.@VERSION@" />
</ItemGroup>
<!--
These implicit <PackageReference/> pull dependencies from NuGet transitively.
They are first added to the <_MauiImplicitPackageReference/> item group to list the the desired
packages. Then the packages that were specified by the user are removed from the list. Finally,
the remaining implicit packages are added into the project.
This logic only installs packages if and only if $(DisableMauiImplicitPackageReferences) is not
true. This property allows the user to totally override all the default nugets installed. This
should not be needed as the $(MauiVersion) should be sufficient. However, there may be a case
to test various CI builds of .NET MAUI.
One thing to note: the old and unsupported $(UseMauiNuGets) property is the same as the new
$(DisableMauiImplicitPackageReferences) property and is just kept for compatibility. It should
not be used any any project, but there are some existing projects that have used them.
-->
<ItemGroup Condition=" '$(DisableMauiImplicitPackageReferences)' != 'true' and '$(UseMauiNuGets)' != 'true' ">
<_MauiImplicitPackageReference Include="Microsoft.Maui.Resizetizer" Version="$(MauiVersion)" PrivateAssets="all" Condition=" '$(UseMauiAssets)' == 'true' " />
<_MauiImplicitPackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiVersion)" Condition=" '$(UseMauiEssentials)' == 'true' ">
<PrivateAssets Condition=" '$(OutputType)' == 'Library' and '$(AndroidApplication)' != 'true' and '$(IsAppExtension)' != 'true'">all</PrivateAssets>
</_MauiImplicitPackageReference>
<_MauiImplicitPackageReference Include="Microsoft.Maui.Core" Version="$(MauiVersion)" Condition=" '$(UseMauiCore)' == 'true' ">
<PrivateAssets Condition=" '$(OutputType)' == 'Library' and '$(AndroidApplication)' != 'true' and '$(IsAppExtension)' != 'true'">all</PrivateAssets>
</_MauiImplicitPackageReference>
<_MauiImplicitPackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" Condition=" '$(UseMaui)' == 'true' ">
<PrivateAssets Condition=" '$(OutputType)' == 'Library' and '$(AndroidApplication)' != 'true' and '$(IsAppExtension)' != 'true'">all</PrivateAssets>
</_MauiImplicitPackageReference>
<_MauiImplicitPackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" IsMauiImplicitOptionalPackageReference="true" Condition=" '$(UseMaui)' == 'true' and '$(UseMauiCompat)' == 'true' ">
<PrivateAssets Condition=" '$(OutputType)' == 'Library' and '$(AndroidApplication)' != 'true' and '$(IsAppExtension)' != 'true'">all</PrivateAssets>
</_MauiImplicitPackageReference>
<_MauiImplicitPackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" Condition=" '$(UseMaui)' == 'true' and '$(UsingMicrosoftNETSdkRazor)' == 'true' ">
<PrivateAssets Condition=" '$(OutputType)' == 'Library' and '$(AndroidApplication)' != 'true' and '$(IsAppExtension)' != 'true'">all</PrivateAssets>
</_MauiImplicitPackageReference>
</ItemGroup>
<!-- Install the nuget packages if we are allowed to -->
<ItemGroup Condition=" '$(DisableMauiImplicitPackageReferences)' != 'true' and '$(UseMauiNuGets)' != 'true' ">
<_MauiImplicitPackageReference Remove="@(PackageReference)" />
<PackageReference Include="@(_MauiImplicitPackageReference)" IsMauiImplicitPackageReference="true" />
<_MauiImplicitRequiredPackageReference Include="@(_MauiImplicitPackageReference->WithMetadataValue('IsMauiImplicitOptionalPackageReference',''))" />
</ItemGroup>
<Target
Name="ValidateMauiImplicitPackageReferences"
AfterTargets="CollectPackageReferences"
Condition="
('$(SkipValidateMauiImplicitPackageReferences)' != 'true') and
('$(DisableMauiImplicitPackageReferences)' != 'true' and '$(UseMauiNuGets)' != 'true') and
('$(UseMaui)' == 'true' or '$(UseMauiCore)' == 'true' or '$(UseMauiEssentials)' == 'true' or '$(UseMauiAssets)' == 'true') and
('@(_MauiImplicitRequiredPackageReference->Count())' != '0') ">
<PropertyGroup>
<_MauiValidateRefsPrefix>Starting with .NET 8, setting </_MauiValidateRefsPrefix>
<!-- <UseMaui>true</UseMaui> -->
<_MauiValidateRefsInfix> does not automatically include NuGet package references in your project. Update your project by including this item: <PackageReference Include="</_MauiValidateRefsInfix>
<!-- Microsoft.Maui.Controls -->
<_MauiValidateRefsSuffix>" Version="$(MauiVersion)" />. You can skip this warning by setting <SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences> in your project file.</_MauiValidateRefsSuffix>
</PropertyGroup>
<Warning
Code="MA002"
Condition="'$(UseMaui)' == 'true'"
Text="$(_MauiValidateRefsPrefix) <UseMaui>true</UseMaui> $(_MauiValidateRefsInfix)Microsoft.Maui.Controls$(_MauiValidateRefsSuffix)" />
<Warning
Code="MA002"
Condition="'$(UseMaui)' == 'true' and '$(UsingMicrosoftNETSdkRazor)' == 'true'"
Text="$(_MauiValidateRefsPrefix) <UseMaui>true</UseMaui> $(_MauiValidateRefsInfix)Microsoft.AspNetCore.Components.WebView.Maui$(_MauiValidateRefsSuffix)" />
<Warning
Code="MA002"
Condition="'$(UseMauiCore)' == 'true'"
Text="$(_MauiValidateRefsPrefix) <UseMauiCore>true</UseMauiCore> $(_MauiValidateRefsInfix)Microsoft.Maui.Core$(_MauiValidateRefsSuffix)" />
<Warning
Code="MA002"
Condition="'$(UseMauiAssets)' == 'true'"
Text="$(_MauiValidateRefsPrefix) <UseMauiAssets>true</UseMauiAssets> $(_MauiValidateRefsInfix)Microsoft.Maui.Resizetizer$(_MauiValidateRefsSuffix)" />
<Warning
Code="MA002"
Condition="'$(UseMauiEssentials)' == 'true'"
Text="$(_MauiValidateRefsPrefix) <UseMauiEssentials>true</UseMauiEssentials> $(_MauiValidateRefsInfix)Microsoft.Maui.Essentials$(_MauiValidateRefsSuffix)" />
</Target>
</Project>