Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .nuspec/AutoImport.InTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
<!-- "Single Project" support - all <ItemGroup/>'s must check if $(EnableDefaultItems) and $(SingleProject) are true -->
<Project>

<ItemDefinitionGroup>
<MauiXaml>
<SubType>Designer</SubType>
</MauiXaml>
</ItemDefinitionGroup>

<ItemGroup Condition="'$(EnableDefaultItems)'=='True' And '$(EnableDefaultXamlItems)'=='True' And '$(EnableDefaultEmbeddedResourceItems)'=='True'">
<MauiXaml Include="**\*.xaml" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);$(DefaultWebContentItemExcludes)"/>
</ItemGroup>

<ItemGroup Condition="'$(EnableDefaultItems)'=='True' And '$(EnableDefaultCssItems)'=='True' And '$(EnableDefaultEmbeddedResourceItems)'=='True'">
<MauiCss Include="**\*.css" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);$(DefaultWebContentItemExcludes)" />
</ItemGroup>
Comment on lines +9 to +21
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this in from DefaultItems.props as that was just a file in the maui repo and was confusing. Also, this chunk of stuff is in the AutoImport.props that the workload uses. This way it is all matching.


<!-- Android -->
<ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' and '$(SingleProject)' == 'true' and '$(TargetPlatformIdentifier)' == 'android' and '$(MonoAndroidResourcePrefix)' != '' ">
<AndroidResource Include="$(MonoAndroidResourcePrefix)/*/*.xml" />
Expand Down Expand Up @@ -97,7 +111,7 @@
Condition="Exists('$(ApplicationManifest)')" />
<AppxManifest
Include="$(PackageManifest)"
Condition="'$(WindowsPackageType)' != 'None' and Exists('$(PackageManifest)')" />
Condition="Exists('$(PackageManifest)')" />
<ApplicationDefinition
Condition="Exists('$(WindowsProjectFolder)App.xaml')"
Include="$(WindowsProjectFolder)App.xaml">
Expand Down
22 changes: 0 additions & 22 deletions .nuspec/Microsoft.Maui.Controls.DefaultItems.props

This file was deleted.

1 change: 1 addition & 0 deletions .nuspec/Microsoft.Maui.Controls.DefaultItems.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
</ItemGroup>

<Import Project="Microsoft.Maui.Controls.SingleProject.targets" />

</Project>
2 changes: 2 additions & 0 deletions .nuspec/Microsoft.Maui.Controls.SingleProject.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup Condition=" '$(SingleProject)' == 'true' and '$([MSBuild]::GetTargetPlatformIdentifier($(TargetFramework)))' == 'windows' ">
<OutputType Condition="'$(OutputType)' == 'Exe'">WinExe</OutputType>
<EnablePreviewMsixTooling Condition="'$(EnablePreviewMsixTooling)' == '' and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true</EnablePreviewMsixTooling>
<WindowsPackageType Condition=" '$(WindowsPackageType)' == '' and '$(EnablePreviewMsixTooling)' == 'true' and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe') ">MSIX</WindowsPackageType>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be here to come before the nugets. Fixes a bug in #5896

<WinUISDKReferences Condition=" '$(WinUISDKReferences)' == '' and '$(EnablePreviewMsixTooling)' == 'true' and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe') ">false</WinUISDKReferences>
Copy link
Copy Markdown
Member Author

@mattleibow mattleibow Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have the order correct, we can also properly exclude the SDKReferences items because they are not something WinUI actually needs. This is a UWP thing. This fixes #5881

<_SingleProjectRIDRequired Condition="'$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe'">true</_SingleProjectRIDRequired>
<_SingleProjectRIDSpecified Condition="'$(RuntimeIdentifier)' != '' or '$(RuntimeIdentifiers)' != ''">true</_SingleProjectRIDSpecified>
</PropertyGroup>
Expand Down
18 changes: 17 additions & 1 deletion .nuspec/Microsoft.Maui.Controls.SingleProject.targets
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
<EnableDefaultPageItems>False</EnableDefaultPageItems>
<EnableDefaultApplicationDefinition>False</EnableDefaultApplicationDefinition>
<_SingleProjectWindowsExcludes>$(WindowsProjectFolder)/**/.*/**</_SingleProjectWindowsExcludes>
<WindowsPackageType Condition=" '$(WindowsPackageType)' == '' and '$(EnablePreviewMsixTooling)' == 'true' and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe') ">MSIX</WindowsPackageType>
</PropertyGroup>

<!--
Expand Down Expand Up @@ -94,6 +93,23 @@

</Target>

<!--
Make sure the properties are valid before validating. Instead of an error when the user
toggles between modes, just handle it and remove the AppxManifest item.
-->
<Target Name="_ValidateWindowsPackageTypeBeforeTarget"
BeforeTargets="_ValidateWindowsPackageType"
DependsOnTargets="_MauiRemoveRemoveAppxManifestForUnpackaged" />

<Target Name="_MauiRemoveRemoveAppxManifestForUnpackaged"
Condition="'$(WindowsPackageType)' == 'None' and '@(AppxManifest)' != ''">

<ItemGroup>
<AppxManifest Remove="@(AppxManifest)" />
</ItemGroup>

</Target>
Comment on lines +104 to +111
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue that #5896 fixes is when the manifest AND unpackaged is specified. That PR tried to fix it by not including the manifest, however, this is wrong because the way the PR did it was to check after the nuget had already defaulted to None and thus never included it.

Technically, this is actually an invalid state with unpackaged AND a manifest, however since we auto-include we also need to un-include. And secondly, what if this is a multi-mode project? Instead of requiring the user to do weird conditions, just not exclude it for the user.


<!-- Import Maui Single Project property pages -->
<PropertyGroup Condition="'$(MauiDesignTimeTargetsPath)' == ''">
<MauiDesignTimeTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Maui\Maui.DesignTime.targets</MauiDesignTimeTargetsPath>
Expand Down
2 changes: 0 additions & 2 deletions .nuspec/Microsoft.Maui.Core.props

This file was deleted.

28 changes: 0 additions & 28 deletions .nuspec/Microsoft.Maui.Core.targets

This file was deleted.

1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

<PropertyGroup>
<MauiRootDirectory>$(MSBuildThisFileDirectory)</MauiRootDirectory>
<MauiSrcDirectory>$(MSBuildThisFileDirectory)src/</MauiSrcDirectory>
<MauiNuSpecDirectory>$(MSBuildThisFileDirectory).nuspec/</MauiNuSpecDirectory>
<DotNetOutputPath>$(MSBuildThisFileDirectory)bin/</DotNetOutputPath>
<DotNetTempDirectory>$(DotNetOutputPath)temp/</DotNetTempDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />

<ItemGroup>
<Content Remove="build\**\*" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<Import Project="..\..\..\Maui.InTree.targets" />
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.TestUtils.DeviceTests.Runners.targets" />
<Import Project="..\..\..\..\Directory.Build.targets" />
<Import Project="$(MauiSrcDirectory)Maui.InTree.targets" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.TestUtils.DeviceTests.Runners.targets" />
<Import Project="$(MauiRootDirectory)Directory.Build.targets" />
Comment on lines -3 to +5
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A big chunk of removing the ../ as this is terribly confusing.


</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
<Compile Remove="**\*.Windows.cs" />
</ItemGroup>

<Import Project="../../../Maui.InTree.props" />
<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@
<Compile Include="Properties\MapsKey.cs" Condition="Exists('Properties\MapsKey.cs')" />
</ItemGroup>

<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All projects that need maui things, like xaml compilation, need to add Maui.InTree.props to the bottom of the .csproj in order to set values that are used by the nugets being imported.


</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@

<Import Project="..\Issues.Shared\Compatibility.ControlGallery.Issues.Shared.projitems" Label="Shared" />

<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>

This file was deleted.

This file was deleted.

7 changes: 7 additions & 0 deletions src/Compatibility/ControlGallery/src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<SampleProject>true</SampleProject>
<UseMaui Condition=" '$(UseWorkload)' == 'true' ">true</UseMaui>
</PropertyGroup>
<Import Project="../../../../Directory.Build.props" />
</Project>
4 changes: 4 additions & 0 deletions src/Compatibility/ControlGallery/src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Project>
<Import Project="$(MauiSrcDirectory)Maui.InTree.targets" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(MauiRootDirectory)Directory.Build.targets" />
Comment on lines +2 to +3
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the Maui.InTree.targets riiiight at the end of the list, but before the parent Directory.Build.targets. The only way to do this is to include the Maui.InTree.targets in a local Directory.Build.targets, and then include the parent afterwards.

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@
<Content Include="xamarinstore.jpg" />
</ItemGroup>

<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>

This file was deleted.

10 changes: 0 additions & 10 deletions src/Compatibility/ControlGallery/src/WinUI/Directory.Build.targets

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@
<ImageAsset Include="Assets.xcassets\**" Visible="False" />
</ItemGroup>

<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
2 changes: 1 addition & 1 deletion src/Compatibility/Core/src/Compatibility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
</PropertyGroup>

<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />

<ItemGroup>
<Compile Remove="GTK\**" />
Expand Down
2 changes: 1 addition & 1 deletion src/Compatibility/Core/src/Windows/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<Import Project="..\..\..\..\..\Directory.Build.targets" />
<Import Project="$(MauiRootDirectory)Directory.Build.targets" />
<Import Project="..\..\..\..\..\eng\UWP.Build.targets" />
<ItemGroup Condition=" '$(OS)' != 'Windows_NT' ">
<Compile Remove="**\*.*" />
Expand Down
2 changes: 1 addition & 1 deletion src/Compatibility/Maps/src/Windows/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<Import Project="../Directory.Build.targets" />
<Import Project="$(MauiRootDirectory)Directory.Build.targets" />
<Import Project="../UWP.Build.targets" />
<ItemGroup Condition=" '$(OS)' != 'Windows_NT' ">
<Compile Remove="**\*.*" />
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/Foldable/src/Controls.Foldable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<WarningsNotAsErrors>BI1234</WarningsNotAsErrors>
<IsPackable>false</IsPackable>
</PropertyGroup>
<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' ">
<!-- remove other AndroidX packages from the MultiTargeting -->
<PackageReference Remove="*" />
Expand Down
4 changes: 0 additions & 4 deletions src/Controls/Foldable/src/Directory.Build.Props

This file was deleted.

4 changes: 0 additions & 4 deletions src/Controls/Foldable/src/Directory.Build.targets

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>

<Import Project="../../../Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
<MauiSplashScreen Include="Resources\Images\dotnet_bot.svg" Color="#FFFFFF" BaseSize="168,208" />
</ItemGroup>

<Import Project="../../../Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
<Content Remove="Properties\launchSettings.json" />
</ItemGroup>

<Import Project="../../../Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@

<Import Condition=" '$(UseMaui)' != 'true' " Project="..\..\..\BlazorWebView\src\Maui\build\Microsoft.AspNetCore.Components.WebView.Maui.targets" />

<Import Project="../../../Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
4 changes: 2 additions & 2 deletions src/Controls/samples/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Import Project="../../Maui.InTree.targets" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="../../../Directory.Build.targets" />
<Import Project="$(MauiSrcDirectory)Maui.InTree.targets" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(MauiRootDirectory)Directory.Build.targets" />
</Project>
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Controls.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<GitInfoReportImportance>high</GitInfoReportImportance>
</PropertyGroup>

<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.MultiTargeting.targets" />
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />

<ItemGroup>
<Compile Remove="Internals\Legacy\**" />
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
<Compile Remove="**\*.Windows.cs" />
</ItemGroup>

<Import Project="../../../Maui.InTree.props" />
<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
6 changes: 3 additions & 3 deletions src/Controls/tests/DeviceTests/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<Import Project="..\..\..\Maui.InTree.targets" />
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.TestUtils.DeviceTests.Runners.targets" />
<Import Project="..\..\..\..\Directory.Build.targets" />
<Import Project="$(MauiSrcDirectory)Maui.InTree.targets" Condition=" '$(UseMaui)' != 'true' " />
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.TestUtils.DeviceTests.Runners.targets" />
<Import Project="$(MauiRootDirectory)Directory.Build.targets" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@
<Compile Include="..\Core.UnitTests\BaseTestFixture.cs" />
</ItemGroup>

<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

</Project>
5 changes: 0 additions & 5 deletions src/Controls/tests/Xaml.UnitTests/Directory.Build.props

This file was deleted.

6 changes: 3 additions & 3 deletions src/Controls/tests/Xaml.UnitTests/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<Import Project="..\..\..\..\Directory.Build.targets" />
<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.Build.Tasks.dll')" />
<Import Project="..\..\..\..\.nuspec\Microsoft.Maui.Controls.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
<Import Project="$(MauiRootDirectory)Directory.Build.targets" />
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.Build.Tasks.dll')" />
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<Import Project="..\..\..\..\..\..\..\..\..\.nuspec\Microsoft.Maui.Controls.DefaultItems.props" />
<Import Project="..\..\..\..\..\..\..\..\..\.nuspec\AutoImport.InTree.props" />
<Import Project="..\..\..\..\..\..\..\..\..\.nuspec\Microsoft.Maui.Controls.props" />
<Import Project="..\..\..\..\..\..\..\..\..\Directory.Build.props" />
</Project>
Loading