From 5e7a6fc576796118f8b9076089049856471f60d4 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 17 Jun 2026 13:19:26 -0400 Subject: [PATCH 1/6] Add MAUI ApplicationArtifact metadata Enrich platform-produced ApplicationArtifact items with MAUI application metadata via GetApplicationArtifactsDependsOn instead of introducing MAUI-specific artifact item groups. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/design/ApplicationArtifact.md | 20 ++++ .../SimpleTemplateTest.cs | 109 ++++++++++++++++++ .../Sdk/Microsoft.Maui.Sdk.After.targets | 20 ++++ 3 files changed, 149 insertions(+) create mode 100644 docs/design/ApplicationArtifact.md diff --git a/docs/design/ApplicationArtifact.md b/docs/design/ApplicationArtifact.md new file mode 100644 index 000000000000..c065d9366e15 --- /dev/null +++ b/docs/design/ApplicationArtifact.md @@ -0,0 +1,20 @@ +# ApplicationArtifact metadata in .NET MAUI + +`@(ApplicationArtifact)` is the shared public item group for final application artifacts. Platform SDKs own the artifact identity, path, format, and platform-specific metadata: + +- .NET for Android creates APK and AAB items. +- .NET for iOS, Mac Catalyst, tvOS, and macOS creates `.app`, `.ipa`, `.pkg`, and `.xcarchive` items. +- Other platforms should populate the same item group from their own build or publish artifact pipeline. + +MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, MAUI participates through `$(GetApplicationArtifactsDependsOn)` and updates existing `@(ApplicationArtifact)` items with MAUI project metadata after the platform SDK has populated them. + +The MAUI metadata enrichment target adds these metadata values when the matching project properties are set: + +- `ApplicationId` +- `ApplicationIdGuid` +- `ApplicationName`, mapped from `ApplicationTitle` +- `ApplicationTitle` +- `ApplicationDisplayVersion` +- `ApplicationVersion` + +`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. They run platform artifact population first, then execute targets appended to `$(GetApplicationArtifactsDependsOn)` before returning `@(ApplicationArtifact)` items. Replacing `$(GetApplicationArtifactsDependsOn)` must not bypass platform artifact population; platform SDKs keep required build/artifact-population targets outside that extensibility property. diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs index d4334c6ecfb5..ac32b821b1c3 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs @@ -303,6 +303,115 @@ public void BuildsWithSpecialCharacters(string id, string projectName, string ex $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); } + [Fact] + public void ApplicationArtifactsAreEnrichedWithMauiMetadata() + { + SetTestIdentifier(nameof(ApplicationArtifactsAreEnrichedWithMauiMetadata)); + var projectDir = TestDirectory; + var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); + var getArtifactsFile = Path.Combine(projectDir, "get-application-artifacts.txt"); + var publishArtifactsFile = Path.Combine(projectDir, "publish-application-artifacts.txt"); + var dependsOnFile = Path.Combine(projectDir, "get-application-artifacts-depends-on.txt"); + + Assert.True(DotnetInternal.New("maui", projectDir, DotNetCurrent, output: _output), + $"Unable to create template maui. Check test output for errors."); + + FileUtilities.ReplaceInFile(projectFile, + "", + """ + + My Artifact App + com.example.artifacts + 11111111-2222-3333-4444-555555555555 + 2.3 + 42 + + + + + + apk + true + com.example.platform + + + app + true + iOS + com.example.platform + + + + + + + + + + + + """); + + Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WriteGetApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: BuildProps, output: _output), + $"Project {Path.GetFileName(projectFile)} failed to write GetApplicationArtifacts metadata. Check test output/attachments for errors."); + Assert.Contains("_AddMauiApplicationArtifactMetadata", File.ReadAllText(dependsOnFile), StringComparison.Ordinal); + AssertApplicationArtifactMetadata(File.ReadAllLines(getArtifactsFile)); + + Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WritePublishApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: BuildProps, output: _output), + $"Project {Path.GetFileName(projectFile)} failed to write Publish metadata. Check test output/attachments for errors."); + AssertApplicationArtifactMetadata(File.ReadAllLines(publishArtifactsFile)); + + static void AssertApplicationArtifactMetadata(string[] artifactLines) + { + Assert.Equal(2, artifactLines.Length); + + AssertArtifact( + artifactLines.Single(line => line.StartsWith("MyArtifactApp-Signed.apk|apk|", StringComparison.Ordinal)), + "MyArtifactApp-Signed.apk", + "apk", + signed: "true", + packageId: "com.example.platform", + platformName: "", + bundleIdentifier: ""); + + AssertArtifact( + artifactLines.Single(line => line.StartsWith("MyArtifactApp.app|app|", StringComparison.Ordinal)), + "MyArtifactApp.app", + "app", + signed: "", + packageId: "", + platformName: "iOS", + bundleIdentifier: "com.example.platform"); + } + + static void AssertArtifact(string artifactLine, string fileName, string packageFormat, string signed, string packageId, string platformName, string bundleIdentifier) + { + var metadata = artifactLine.Split('|'); + + Assert.Equal(fileName, metadata[0]); + Assert.Equal(packageFormat, metadata[1]); + Assert.Equal("My Artifact App", metadata[2]); + Assert.Equal("My Artifact App", metadata[3]); + Assert.Equal("com.example.artifacts", metadata[4]); + Assert.Equal("11111111-2222-3333-4444-555555555555", metadata[5]); + Assert.Equal("2.3", metadata[6]); + Assert.Equal("42", metadata[7]); + Assert.Equal(signed, metadata[8]); + Assert.Equal(packageId, metadata[9]); + Assert.Equal(platformName, metadata[10]); + Assert.Equal(bundleIdentifier, metadata[11]); + } + } + [Theory] // Parameters: short name, target framework, build config, use pack target, additionalDotNetBuildParams [InlineData("maui", DotNetPrevious, "Debug", false, "")] diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets index c63be6442e01..0e98709c7186 100644 --- a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets +++ b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets @@ -13,6 +13,13 @@ + + + $(GetApplicationArtifactsDependsOn); + _AddMauiApplicationArtifactMetadata + + + @@ -30,4 +37,17 @@ Platforms\Android\AndroidManifest.xml + + + + $(ApplicationId) + $(ApplicationIdGuid) + $(ApplicationTitle) + $(ApplicationTitle) + $(ApplicationDisplayVersion) + $(ApplicationVersion) + + + + From c7165cbd99c6de1efb37e1a5afaaa53e55827dec Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 17 Jun 2026 16:02:41 -0400 Subject: [PATCH 2/6] Clarify ApplicationArtifact production pipeline Document that platform build/artifact-production steps populate ApplicationArtifact items before MAUI metadata enrichment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/design/ApplicationArtifact.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/design/ApplicationArtifact.md b/docs/design/ApplicationArtifact.md index c065d9366e15..0f3fe45ab561 100644 --- a/docs/design/ApplicationArtifact.md +++ b/docs/design/ApplicationArtifact.md @@ -1,12 +1,12 @@ # ApplicationArtifact metadata in .NET MAUI -`@(ApplicationArtifact)` is the shared public item group for final application artifacts. Platform SDKs own the artifact identity, path, format, and platform-specific metadata: +`@(ApplicationArtifact)` is the shared public item group for final application artifacts. Platform SDKs own the artifact-production pipeline and the artifact identity, path, format, and platform-specific metadata: - .NET for Android creates APK and AAB items. - .NET for iOS, Mac Catalyst, tvOS, and macOS creates `.app`, `.ipa`, `.pkg`, and `.xcarchive` items. -- Other platforms should populate the same item group from their own build or publish artifact pipeline. +- Other platforms should populate the same item group from their own build/artifact-production or publish artifact pipeline. -MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, MAUI participates through `$(GetApplicationArtifactsDependsOn)` and updates existing `@(ApplicationArtifact)` items with MAUI project metadata after the platform SDK has populated them. +MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, MAUI participates through `$(GetApplicationArtifactsDependsOn)` and updates existing `@(ApplicationArtifact)` items with MAUI project metadata after the platform SDK's mandatory build/artifact-production steps have populated them. The MAUI metadata enrichment target adds these metadata values when the matching project properties are set: @@ -17,4 +17,4 @@ The MAUI metadata enrichment target adds these metadata values when the matching - `ApplicationDisplayVersion` - `ApplicationVersion` -`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. They run platform artifact population first, then execute targets appended to `$(GetApplicationArtifactsDependsOn)` before returning `@(ApplicationArtifact)` items. Replacing `$(GetApplicationArtifactsDependsOn)` must not bypass platform artifact population; platform SDKs keep required build/artifact-population targets outside that extensibility property. +`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. They run mandatory platform build/artifact-production steps first, then execute targets appended to `$(GetApplicationArtifactsDependsOn)` before returning `@(ApplicationArtifact)` items. Replacing `$(GetApplicationArtifactsDependsOn)` must not bypass platform artifact population; platform SDKs keep required build/artifact-population targets outside that extensibility property. From c4bb4e6e568f070efa7ffbb3abb96e3deaf3f501 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 17 Jun 2026 16:15:39 -0400 Subject: [PATCH 3/6] Clarify ApplicationArtifact Build contract Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/design/ApplicationArtifact.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/design/ApplicationArtifact.md b/docs/design/ApplicationArtifact.md index 0f3fe45ab561..9544a5cfb27b 100644 --- a/docs/design/ApplicationArtifact.md +++ b/docs/design/ApplicationArtifact.md @@ -1,12 +1,12 @@ # ApplicationArtifact metadata in .NET MAUI -`@(ApplicationArtifact)` is the shared public item group for final application artifacts. Platform SDKs own the artifact-production pipeline and the artifact identity, path, format, and platform-specific metadata: +`@(ApplicationArtifact)` is the shared public item group for final application artifacts. Platform SDKs own creating these items and their artifact identity, path, format, and platform-specific metadata: - .NET for Android creates APK and AAB items. - .NET for iOS, Mac Catalyst, tvOS, and macOS creates `.app`, `.ipa`, `.pkg`, and `.xcarchive` items. -- Other platforms should populate the same item group from their own build/artifact-production or publish artifact pipeline. +- Other platforms should populate the same item group from their own build or publish pipeline. -MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, MAUI participates through `$(GetApplicationArtifactsDependsOn)` and updates existing `@(ApplicationArtifact)` items with MAUI project metadata after the platform SDK's mandatory build/artifact-production steps have populated them. +MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, MAUI participates through `$(GetApplicationArtifactsDependsOn)` and updates existing `@(ApplicationArtifact)` items with MAUI project metadata after the platform SDK `GetApplicationArtifacts` target has run `Build` and platform-produced items exist. The MAUI metadata enrichment target adds these metadata values when the matching project properties are set: @@ -17,4 +17,4 @@ The MAUI metadata enrichment target adds these metadata values when the matching - `ApplicationDisplayVersion` - `ApplicationVersion` -`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. They run mandatory platform build/artifact-production steps first, then execute targets appended to `$(GetApplicationArtifactsDependsOn)` before returning `@(ApplicationArtifact)` items. Replacing `$(GetApplicationArtifactsDependsOn)` must not bypass platform artifact population; platform SDKs keep required build/artifact-population targets outside that extensibility property. +`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. Platform SDK `GetApplicationArtifacts` depends on `Build`, then executes targets appended to `$(GetApplicationArtifactsDependsOn)` before returning `@(ApplicationArtifact)` items. `Publish` uses the same post-`Build` extension path before returning items. Replacing `$(GetApplicationArtifactsDependsOn)` must not bypass platform build or platform artifact population; platform SDKs keep `Build` outside that extensibility property. From 50a88727f0c840d877c1a330b43679b29af28c62 Mon Sep 17 00:00:00 2001 From: redth Date: Tue, 14 Jul 2026 13:26:47 -0400 Subject: [PATCH 4/6] Use defaults for MAUI ApplicationArtifact metadata Align MAUI augmentation with the landed Android and Apple artifact contracts, including Android publish item recreation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e7b83c8e-9ff9-4712-87cf-f7a4c970f792 --- docs/design/ApplicationArtifact.md | 8 +- .../SimpleTemplateTest.cs | 91 +++++++++++-------- .../Sdk/Microsoft.Maui.Sdk.After.targets | 29 ++---- 3 files changed, 68 insertions(+), 60 deletions(-) diff --git a/docs/design/ApplicationArtifact.md b/docs/design/ApplicationArtifact.md index 9544a5cfb27b..2a979d5c5047 100644 --- a/docs/design/ApplicationArtifact.md +++ b/docs/design/ApplicationArtifact.md @@ -6,9 +6,9 @@ - .NET for iOS, Mac Catalyst, tvOS, and macOS creates `.app`, `.ipa`, `.pkg`, and `.xcarchive` items. - Other platforms should populate the same item group from their own build or publish pipeline. -MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, MAUI participates through `$(GetApplicationArtifactsDependsOn)` and updates existing `@(ApplicationArtifact)` items with MAUI project metadata after the platform SDK `GetApplicationArtifacts` target has run `Build` and platform-produced items exist. +MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, it defines default MAUI metadata for the shared `ApplicationArtifact` item type. Platform SDKs create the items, and the defaults supplement their platform-specific metadata. -The MAUI metadata enrichment target adds these metadata values when the matching project properties are set: +MAUI supplies these metadata values when the matching project properties are set: - `ApplicationId` - `ApplicationIdGuid` @@ -17,4 +17,6 @@ The MAUI metadata enrichment target adds these metadata values when the matching - `ApplicationDisplayVersion` - `ApplicationVersion` -`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. Platform SDK `GetApplicationArtifacts` depends on `Build`, then executes targets appended to `$(GetApplicationArtifactsDependsOn)` before returning `@(ApplicationArtifact)` items. `Publish` uses the same post-`Build` extension path before returning items. Replacing `$(GetApplicationArtifactsDependsOn)` must not bypass platform build or platform artifact population; platform SDKs keep `Build` outside that extensibility property. +The defaults are declared with an MSBuild `ItemDefinitionGroup`, so explicit metadata from a platform SDK takes precedence. The defaults also apply when a platform recreates an item, as Android does when changing artifact identities to published paths. + +`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. MAUI only supplies shared metadata and does not change which artifacts those targets produce or return. diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs index ac32b821b1c3..11ecb2a7c126 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs @@ -309,13 +309,22 @@ public void ApplicationArtifactsAreEnrichedWithMauiMetadata() SetTestIdentifier(nameof(ApplicationArtifactsAreEnrichedWithMauiMetadata)); var projectDir = TestDirectory; var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); - var getArtifactsFile = Path.Combine(projectDir, "get-application-artifacts.txt"); - var publishArtifactsFile = Path.Combine(projectDir, "publish-application-artifacts.txt"); - var dependsOnFile = Path.Combine(projectDir, "get-application-artifacts-depends-on.txt"); + var seededArtifactsFile = Path.Combine(projectDir, "seeded-application-artifacts.txt"); + var publishedArtifactsFile = Path.Combine(projectDir, "published-application-artifacts.txt"); + var mauiSdkAfterTargets = Path.Combine( + TestEnvironment.GetMauiDirectory(), + "src", + "Workload", + "Microsoft.Maui.Sdk", + "Sdk", + "Microsoft.Maui.Sdk.After.targets"); Assert.True(DotnetInternal.New("maui", projectDir, DotNetCurrent, output: _output), $"Unable to create template maui. Check test output for errors."); + var buildProps = BuildProps; + buildProps.Add($"MauiSdkAfterTargets=\"{mauiSdkAfterTargets}\""); + FileUtilities.ReplaceInFile(projectFile, "", """ @@ -326,49 +335,58 @@ public void ApplicationArtifactsAreEnrichedWithMauiMetadata() 2.3 42 - + apk true com.example.platform + arm64-v8a - - app - true - iOS - com.example.platform + + aab + true + com.example.platform - - + - + + + <_ApplicationArtifactForPublish Include="@(ApplicationArtifact)" /> + <_ApplicationArtifactPublishCopy + Include="@(_ApplicationArtifactForPublish->'$(MSBuildProjectDirectory)/artifacts/publish/%(Filename)%(Extension)')"> + %(_ApplicationArtifactForPublish.PackageFormat) + %(_ApplicationArtifactForPublish.Signed) + %(_ApplicationArtifactForPublish.PackageId) + %(_ApplicationArtifactForPublish.Abi) + + + + + + """); - Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WriteGetApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: BuildProps, output: _output), - $"Project {Path.GetFileName(projectFile)} failed to write GetApplicationArtifacts metadata. Check test output/attachments for errors."); - Assert.Contains("_AddMauiApplicationArtifactMetadata", File.ReadAllText(dependsOnFile), StringComparison.Ordinal); - AssertApplicationArtifactMetadata(File.ReadAllLines(getArtifactsFile)); + Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WriteSeededApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: buildProps, output: _output), + $"Project {Path.GetFileName(projectFile)} failed to write seeded ApplicationArtifact metadata. Check test output/attachments for errors."); + AssertApplicationArtifactMetadata(File.ReadAllLines(seededArtifactsFile)); - Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WritePublishApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: BuildProps, output: _output), - $"Project {Path.GetFileName(projectFile)} failed to write Publish metadata. Check test output/attachments for errors."); - AssertApplicationArtifactMetadata(File.ReadAllLines(publishArtifactsFile)); + Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WritePublishedApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: buildProps, output: _output), + $"Project {Path.GetFileName(projectFile)} failed to write published ApplicationArtifact metadata. Check test output/attachments for errors."); + AssertApplicationArtifactMetadata(File.ReadAllLines(publishedArtifactsFile)); static void AssertApplicationArtifactMetadata(string[] artifactLines) { @@ -380,20 +398,18 @@ static void AssertApplicationArtifactMetadata(string[] artifactLines) "apk", signed: "true", packageId: "com.example.platform", - platformName: "", - bundleIdentifier: ""); + abi: "arm64-v8a"); AssertArtifact( - artifactLines.Single(line => line.StartsWith("MyArtifactApp.app|app|", StringComparison.Ordinal)), - "MyArtifactApp.app", - "app", - signed: "", - packageId: "", - platformName: "iOS", - bundleIdentifier: "com.example.platform"); + artifactLines.Single(line => line.StartsWith("MyArtifactApp-Signed.aab|aab|", StringComparison.Ordinal)), + "MyArtifactApp-Signed.aab", + "aab", + signed: "true", + packageId: "com.example.platform", + abi: ""); } - static void AssertArtifact(string artifactLine, string fileName, string packageFormat, string signed, string packageId, string platformName, string bundleIdentifier) + static void AssertArtifact(string artifactLine, string fileName, string packageFormat, string signed, string packageId, string abi) { var metadata = artifactLine.Split('|'); @@ -407,8 +423,7 @@ static void AssertArtifact(string artifactLine, string fileName, string packageF Assert.Equal("42", metadata[7]); Assert.Equal(signed, metadata[8]); Assert.Equal(packageId, metadata[9]); - Assert.Equal(platformName, metadata[10]); - Assert.Equal(bundleIdentifier, metadata[11]); + Assert.Equal(abi, metadata[10]); } } diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets index 0e98709c7186..0a69d9303f3e 100644 --- a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets +++ b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets @@ -13,12 +13,16 @@ - - - $(GetApplicationArtifactsDependsOn); - _AddMauiApplicationArtifactMetadata - - + + + $(ApplicationId) + $(ApplicationIdGuid) + $(ApplicationTitle) + $(ApplicationTitle) + $(ApplicationDisplayVersion) + $(ApplicationVersion) + + @@ -37,17 +41,4 @@ Platforms\Android\AndroidManifest.xml - - - - $(ApplicationId) - $(ApplicationIdGuid) - $(ApplicationTitle) - $(ApplicationTitle) - $(ApplicationDisplayVersion) - $(ApplicationVersion) - - - - From b0fb7a21c11207b163937aa196e8837295b146c0 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 15 Jul 2026 13:25:56 -0400 Subject: [PATCH 5/6] Add Windows App SDK application artifacts Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e7b83c8e-9ff9-4712-87cf-f7a4c970f792 --- Microsoft.Maui-dev.sln | 7 + Microsoft.Maui-mac.slnf | 1 + Microsoft.Maui-windows.slnf | 1 + Microsoft.Maui.sln | 7 + docs/design/ApplicationArtifact.md | 34 +- docs/design/NuGets.md | 9 +- eng/Microsoft.Maui.Packages-mac.slnf | 1 + eng/Microsoft.Maui.Packages.slnf | 1 + eng/cake/dotnet.cake | 1 + src/Core/src/Core.csproj | 3 + .../BaseBuildTest.cs | 1 + .../SimpleTemplateTest.cs | 124 ----- .../WindowsApplicationArtifactsPackageTest.cs | 505 ++++++++++++++++++ .../WindowsTemplateTest.cs | 296 +++++++++- ...t.Maui.ApplicationArtifacts.Windows.csproj | 21 + ....Maui.ApplicationArtifacts.Windows.targets | 490 +++++++++++++++++ .../Sdk/Microsoft.Maui.Sdk.After.targets | 11 - .../WorkloadManifest.in.json | 5 + src/Workload/README.md | 2 + 19 files changed, 1372 insertions(+), 148 deletions(-) create mode 100644 src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsPackageTest.cs create mode 100644 src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj create mode 100644 src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets diff --git a/Microsoft.Maui-dev.sln b/Microsoft.Maui-dev.sln index 5d7ab932aaab..afbd8b5369bc 100644 --- a/Microsoft.Maui-dev.sln +++ b/Microsoft.Maui-dev.sln @@ -257,6 +257,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UITest.Analyzers.Tests", "s EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maui25871Library", "src\Controls\tests\Maui25871Library\Maui25871Library.csproj", "{8820D95F-EB6D-4B70-4985-759AAC83CF68}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.ApplicationArtifacts.Windows", "src\Workload\Microsoft.Maui.ApplicationArtifacts.Windows\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "{3BC53DE7-90E7-47FB-9A70-D913782E07D6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -662,6 +664,10 @@ Global {8820D95F-EB6D-4B70-4985-759AAC83CF68}.Debug|Any CPU.Build.0 = Debug|Any CPU {8820D95F-EB6D-4B70-4985-759AAC83CF68}.Release|Any CPU.ActiveCfg = Release|Any CPU {8820D95F-EB6D-4B70-4985-759AAC83CF68}.Release|Any CPU.Build.0 = Release|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -780,6 +786,7 @@ Global {1A031B27-6EE7-35A8-5C38-EB7370E6029E} = {6A5A18F7-8A4B-639B-2D50-68074424D750} {5E0D0ACD-EA38-448D-B643-30B966A41922} = {1A031B27-6EE7-35A8-5C38-EB7370E6029E} {8820D95F-EB6D-4B70-4985-759AAC83CF68} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} + {3BC53DE7-90E7-47FB-9A70-D913782E07D6} = {EC63FD88-5E12-46D7-B440-68F70241D987} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50} diff --git a/Microsoft.Maui-mac.slnf b/Microsoft.Maui-mac.slnf index 8b3c73639fcc..c3b4fedcec20 100644 --- a/Microsoft.Maui-mac.slnf +++ b/Microsoft.Maui-mac.slnf @@ -68,6 +68,7 @@ "src\\TestUtils\\src\\VisualTestUtils\\VisualTestUtils.csproj", "src\\TestUtils\\src\\VisualTestUtils.MagickNet\\VisualTestUtils.MagickNet.csproj", "src\\TestUtils\\src\\Microsoft.Maui.IntegrationTests\\Microsoft.Maui.IntegrationTests.csproj", + "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/Microsoft.Maui-windows.slnf b/Microsoft.Maui-windows.slnf index b5affb7f5992..79c21e14183f 100644 --- a/Microsoft.Maui-windows.slnf +++ b/Microsoft.Maui-windows.slnf @@ -86,6 +86,7 @@ "src\\TestUtils\\src\\UITest.NUnit\\UITest.NUnit.csproj", "src\\TestUtils\\src\\VisualTestUtils\\VisualTestUtils.csproj", "src\\TestUtils\\src\\VisualTestUtils.MagickNet\\VisualTestUtils.MagickNet.csproj", + "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/Microsoft.Maui.sln b/Microsoft.Maui.sln index c556e985bcca..f4d872a9d6b4 100644 --- a/Microsoft.Maui.sln +++ b/Microsoft.Maui.sln @@ -248,6 +248,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls.ManualTests", "src EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualTestUtils.MagickNet.Tests", "src\TestUtils\tests\VisualTestUtils.MagickNet.Tests\VisualTestUtils.MagickNet.Tests.csproj", "{77D32E05-DF9A-4580-9F0E-E765D74B87EF}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.ApplicationArtifacts.Windows", "src\Workload\Microsoft.Maui.ApplicationArtifacts.Windows\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "{3BC53DE7-90E7-47FB-9A70-D913782E07D6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -649,6 +651,10 @@ Global {77D32E05-DF9A-4580-9F0E-E765D74B87EF}.Debug|Any CPU.Build.0 = Debug|Any CPU {77D32E05-DF9A-4580-9F0E-E765D74B87EF}.Release|Any CPU.ActiveCfg = Release|Any CPU {77D32E05-DF9A-4580-9F0E-E765D74B87EF}.Release|Any CPU.Build.0 = Release|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -764,6 +770,7 @@ Global {4ADCBA87-30DB-44F5-85E9-94A4F4132FD9} = {E1082E26-D700-4127-9329-66D673FD2D55} {E2BFD1F1-07A8-8DBE-3661-894D0FE37D9C} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} {77D32E05-DF9A-4580-9F0E-E765D74B87EF} = {6998CAA1-11D4-46B2-B80F-0AC882F58124} + {3BC53DE7-90E7-47FB-9A70-D913782E07D6} = {EC63FD88-5E12-46D7-B440-68F70241D987} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50} diff --git a/docs/design/ApplicationArtifact.md b/docs/design/ApplicationArtifact.md index 2a979d5c5047..62dfdcb5570b 100644 --- a/docs/design/ApplicationArtifact.md +++ b/docs/design/ApplicationArtifact.md @@ -4,19 +4,39 @@ - .NET for Android creates APK and AAB items. - .NET for iOS, Mac Catalyst, tvOS, and macOS creates `.app`, `.ipa`, `.pkg`, and `.xcarchive` items. +- `Microsoft.Maui.ApplicationArtifacts.Windows` creates items for modern SDK-style Windows App SDK applications. - Other platforms should populate the same item group from their own build or publish pipeline. -MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Instead, it defines default MAUI metadata for the shared `ApplicationArtifact` item type. Platform SDKs create the items, and the defaults supplement their platform-specific metadata. - -MAUI supplies these metadata values when the matching project properties are set: +MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Each producer attaches common metadata from its final manifest or resolved build output: - `ApplicationId` -- `ApplicationIdGuid` -- `ApplicationName`, mapped from `ApplicationTitle` +- `ApplicationName` - `ApplicationTitle` - `ApplicationDisplayVersion` - `ApplicationVersion` -The defaults are declared with an MSBuild `ItemDefinitionGroup`, so explicit metadata from a platform SDK takes precedence. The defaults also apply when a platform recreates an item, as Android does when changing artifact identities to published paths. +Platform-specific metadata remains available alongside the common values, such as Android `PackageId`, Apple `BundleIdentifier`, and Windows `PackageVersion`. `ApplicationIdGuid` is Windows-specific and is present only when the effective package identity is a GUID. Resource-backed names remain resource references when the build cannot resolve a single locale. + +Each platform owns `GetApplicationArtifacts`, retains `$(GetApplicationArtifactsDependsOn)` as the downstream extension point, and makes the collected items available during Publish. + +## Windows App SDK + +`Microsoft.Maui.ApplicationArtifacts.Windows` is a targets-only `buildTransitive` package with no MAUI runtime, Resizetizer, or MAUI build-task dependency. `Microsoft.Maui.Core` depends on it only for Windows target frameworks, and non-MAUI Windows App SDK applications can reference it directly. It activates for real, non-design-time Windows App SDK application builds with `Exe` or `WinExe` output. Set `EnableWindowsApplicationArtifacts` to `false` to disable it. Classic `.wapproj` packaging is not supported. + +The package defines `GetApplicationArtifacts`, retains `$(GetApplicationArtifactsDependsOn)` as the downstream extension point, and makes publish-path items available to `AfterTargets="Publish"` consumers in the same invocation. It reads final Windows App SDK output properties and item lists rather than searching output directories. + +Each Windows item has an `ArtifactRole`: + +- `Primary` +- `PayloadDirectory` +- `Bundle` +- `StoreUpload` +- `DeploymentManifest` +- `Symbols` +- `Certificate` +- `InstallScript` +- `DependencyPackage` +- `LandingPage` +- `Support` -`GetApplicationArtifacts` and `Publish` remain platform-owned result paths. MAUI only supplies shared metadata and does not change which artifacts those targets produce or return. +Windows items also provide `IsPrimary`, `PrimaryArtifact`, `PackageFormat`, `PackageType`, `PackageVersion`, `Architecture`, `RuntimeIdentifier`, `Signed`, `BundlePlatforms`, `EntryPoint`, and `DeploymentDirectory` when available. Packaged identity, display name, and version metadata comes from the final Appx manifest, including unchanged `ms-resource:` references. diff --git a/docs/design/NuGets.md b/docs/design/NuGets.md index edf676bff05a..5cedce9b0c22 100644 --- a/docs/design/NuGets.md +++ b/docs/design/NuGets.md @@ -12,6 +12,7 @@ There are several artifacts in the .NET MAUI "universe": * `Microsoft.Maui.Controls.Xaml` - The XAML parser * `Microsoft.Maui.Controls.Build.Tasks` - The real set of XAML[C|G] targets and globs * `Microsoft.Maui.Resizetizer` - The framework-and-platform-agnostic asset generator and integrator + * `Microsoft.Maui.ApplicationArtifacts.Windows` - Targets-only discovery of final Windows App SDK application outputs * `Microsoft.Maui.Core` - The base interfaces and handlers for all .NET MAUI things * `Microsoft.Maui.Essentials` - The core set of framework-agnostic, cross-platform APIs * .NET MAUI maps support: @@ -41,6 +42,7 @@ Most nugets do not contain or need targets and/or props files, but some do. Thes - Manifest - `Microsoft.NET.Sdk.Maui.Manifest` - SDK - `Microsoft.Maui.Sdk` - NuGet Packages + - Windows application artifacts - `Microsoft.Maui.ApplicationArtifacts.Windows` - Controls - `Microsoft.Maui.Controls.Build.Tasks` - Core - `Microsoft.Maui.Core` - Resizetizer - `Microsoft.Maui.Resizetizer` @@ -103,12 +105,17 @@ The targets file can then import all the SDK: ### Targets in the Packs -There are 3 packs today that need targets: +There are 4 packs today that need targets: + - Windows application artifacts - `Microsoft.Maui.ApplicationArtifacts.Windows` - Controls - `Microsoft.Maui.Controls.Build.Tasks` - Core - `Microsoft.Maui.Core` - Resizetizer - `Microsoft.Maui.Resizetizer` +#### Targets in Windows application artifacts + +`Microsoft.Maui.ApplicationArtifacts.Windows` is a neutral, targets-only package. Its `buildTransitive` target discovers final outputs from modern SDK-style Windows App SDK application projects and exposes them as `@(ApplicationArtifact)`. It has no dependency on MAUI runtime assemblies, Resizetizer, or MAUI build tasks, so non-MAUI Windows App SDK applications can reference it directly. Classic `.wapproj` packaging is not supported. + #### Targets in Controls The Controls section of MAUI is the main set of libraries that a MAUI app uses. The targets and props needed but MAUI mostly live in the `Microsoft.Maui.Controls.Build.Tasks` nuget. This is mainly because of the dependency structure of MAUI. diff --git a/eng/Microsoft.Maui.Packages-mac.slnf b/eng/Microsoft.Maui.Packages-mac.slnf index 0fc5381ff863..1562ad5fcb33 100644 --- a/eng/Microsoft.Maui.Packages-mac.slnf +++ b/eng/Microsoft.Maui.Packages-mac.slnf @@ -21,6 +21,7 @@ "src\\Graphics\\src\\Text.Markdig\\Graphics.Text.Markdig.csproj", "src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj", "src\\Templates\\src\\Microsoft.Maui.Templates.csproj", + "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/eng/Microsoft.Maui.Packages.slnf b/eng/Microsoft.Maui.Packages.slnf index 1318306144c1..225c00363656 100644 --- a/eng/Microsoft.Maui.Packages.slnf +++ b/eng/Microsoft.Maui.Packages.slnf @@ -24,6 +24,7 @@ "src\\Essentials\\src\\Essentials.csproj", "src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj", "src\\Templates\\src\\Microsoft.Maui.Templates.csproj", + "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/eng/cake/dotnet.cake b/eng/cake/dotnet.cake index c4f2f5d1c440..b8eb4302c22c 100644 --- a/eng/cake/dotnet.cake +++ b/eng/cake/dotnet.cake @@ -34,6 +34,7 @@ var NuGetOnlyPackages = new string[] { "Microsoft.Maui.Core.*.{nupkg,snupkg}", "Microsoft.Maui.Essentials.*.{nupkg,snupkg}", "Microsoft.Maui.Graphics.*.{nupkg,snupkg}", + "Microsoft.Maui.ApplicationArtifacts.Windows.*.{nupkg,snupkg}", "Microsoft.Maui.Maps.*.{nupkg,snupkg}", "Microsoft.Maui.Resizetizer.*.{nupkg,snupkg}", "Microsoft.AspNetCore.Components.WebView.*.{nupkg,snupkg}", diff --git a/src/Core/src/Core.csproj b/src/Core/src/Core.csproj index c96fa7b0f704..17cc628ea20f 100644 --- a/src/Core/src/Core.csproj +++ b/src/Core/src/Core.csproj @@ -53,6 +53,9 @@ + diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs index 56dc30dbf7d0..f0e0ae3a578d 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs @@ -44,6 +44,7 @@ private void SetUpNuGetPackages() "Microsoft.Maui.Core.*.nupkg", "Microsoft.Maui.Essentials.*.nupkg", "Microsoft.Maui.Graphics.*.nupkg", + "Microsoft.Maui.ApplicationArtifacts.Windows.*.nupkg", "Microsoft.Maui.Maps.*.nupkg", "Microsoft.Maui.Resizetizer.*.nupkg", "Microsoft.AspNetCore.Components.WebView.*.nupkg", diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs index 11ecb2a7c126..d4334c6ecfb5 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs @@ -303,130 +303,6 @@ public void BuildsWithSpecialCharacters(string id, string projectName, string ex $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); } - [Fact] - public void ApplicationArtifactsAreEnrichedWithMauiMetadata() - { - SetTestIdentifier(nameof(ApplicationArtifactsAreEnrichedWithMauiMetadata)); - var projectDir = TestDirectory; - var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); - var seededArtifactsFile = Path.Combine(projectDir, "seeded-application-artifacts.txt"); - var publishedArtifactsFile = Path.Combine(projectDir, "published-application-artifacts.txt"); - var mauiSdkAfterTargets = Path.Combine( - TestEnvironment.GetMauiDirectory(), - "src", - "Workload", - "Microsoft.Maui.Sdk", - "Sdk", - "Microsoft.Maui.Sdk.After.targets"); - - Assert.True(DotnetInternal.New("maui", projectDir, DotNetCurrent, output: _output), - $"Unable to create template maui. Check test output for errors."); - - var buildProps = BuildProps; - buildProps.Add($"MauiSdkAfterTargets=\"{mauiSdkAfterTargets}\""); - - FileUtilities.ReplaceInFile(projectFile, - "", - """ - - My Artifact App - com.example.artifacts - 11111111-2222-3333-4444-555555555555 - 2.3 - 42 - - - - - - apk - true - com.example.platform - arm64-v8a - - - aab - true - com.example.platform - - - - - - - - - <_ApplicationArtifactForPublish Include="@(ApplicationArtifact)" /> - <_ApplicationArtifactPublishCopy - Include="@(_ApplicationArtifactForPublish->'$(MSBuildProjectDirectory)/artifacts/publish/%(Filename)%(Extension)')"> - %(_ApplicationArtifactForPublish.PackageFormat) - %(_ApplicationArtifactForPublish.Signed) - %(_ApplicationArtifactForPublish.PackageId) - %(_ApplicationArtifactForPublish.Abi) - - - - - - - - - - """); - - Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WriteSeededApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: buildProps, output: _output), - $"Project {Path.GetFileName(projectFile)} failed to write seeded ApplicationArtifact metadata. Check test output/attachments for errors."); - AssertApplicationArtifactMetadata(File.ReadAllLines(seededArtifactsFile)); - - Assert.True(DotnetInternal.Build(projectFile, "Debug", target: "WritePublishedApplicationArtifactsMetadata", framework: $"{DotNetCurrent}-android", properties: buildProps, output: _output), - $"Project {Path.GetFileName(projectFile)} failed to write published ApplicationArtifact metadata. Check test output/attachments for errors."); - AssertApplicationArtifactMetadata(File.ReadAllLines(publishedArtifactsFile)); - - static void AssertApplicationArtifactMetadata(string[] artifactLines) - { - Assert.Equal(2, artifactLines.Length); - - AssertArtifact( - artifactLines.Single(line => line.StartsWith("MyArtifactApp-Signed.apk|apk|", StringComparison.Ordinal)), - "MyArtifactApp-Signed.apk", - "apk", - signed: "true", - packageId: "com.example.platform", - abi: "arm64-v8a"); - - AssertArtifact( - artifactLines.Single(line => line.StartsWith("MyArtifactApp-Signed.aab|aab|", StringComparison.Ordinal)), - "MyArtifactApp-Signed.aab", - "aab", - signed: "true", - packageId: "com.example.platform", - abi: ""); - } - - static void AssertArtifact(string artifactLine, string fileName, string packageFormat, string signed, string packageId, string abi) - { - var metadata = artifactLine.Split('|'); - - Assert.Equal(fileName, metadata[0]); - Assert.Equal(packageFormat, metadata[1]); - Assert.Equal("My Artifact App", metadata[2]); - Assert.Equal("My Artifact App", metadata[3]); - Assert.Equal("com.example.artifacts", metadata[4]); - Assert.Equal("11111111-2222-3333-4444-555555555555", metadata[5]); - Assert.Equal("2.3", metadata[6]); - Assert.Equal("42", metadata[7]); - Assert.Equal(signed, metadata[8]); - Assert.Equal(packageId, metadata[9]); - Assert.Equal(abi, metadata[10]); - } - } - [Theory] // Parameters: short name, target framework, build config, use pack target, additionalDotNetBuildParams [InlineData("maui", DotNetPrevious, "Debug", false, "")] diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsPackageTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsPackageTest.cs new file mode 100644 index 000000000000..a1e5a6f6918e --- /dev/null +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsPackageTest.cs @@ -0,0 +1,505 @@ +using System.IO.Compression; +using System.Security; +using System.Xml.Linq; + +namespace Microsoft.Maui.IntegrationTests; + +[Trait("Category", "Build")] +public class WindowsApplicationArtifactsPackageTest : BaseBuildTest +{ + const string PackageId = "Microsoft.Maui.ApplicationArtifacts.Windows"; + + public WindowsApplicationArtifactsPackageTest(IntegrationTestFixture fixture, ITestOutputHelper output) + : base(fixture, output) + { + } + + [Fact] + public void PackageContainsOnlyNeutralBuildAssets() + { + SetTestIdentifier(nameof(PackageContainsOnlyNeutralBuildAssets)); + var packagePath = FindPackage(PackageId); + + using var archive = ZipFile.OpenRead(packagePath); + var entries = archive.Entries.Select(entry => entry.FullName).ToArray(); + + Assert.Contains("buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets", entries); + Assert.DoesNotContain(entries, entry => + entry.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || + entry.StartsWith("lib/", StringComparison.OrdinalIgnoreCase) || + entry.StartsWith("runtimes/", StringComparison.OrdinalIgnoreCase) || + entry.StartsWith("tools/", StringComparison.OrdinalIgnoreCase) || + entry.StartsWith("analyzers/", StringComparison.OrdinalIgnoreCase)); + Assert.Single(entries.Where(entry => entry.StartsWith("buildTransitive/", StringComparison.OrdinalIgnoreCase))); + + var nuspecEntry = Assert.Single(archive.Entries.Where(entry => entry.FullName.EndsWith(".nuspec", StringComparison.OrdinalIgnoreCase))); + using var nuspecStream = nuspecEntry.Open(); + var nuspec = XDocument.Load(nuspecStream); + var ns = nuspec.Root!.Name.Namespace; + var packageType = Assert.Single(nuspec.Descendants(ns + "packageType")); + Assert.Equal("Dependency", (string?)packageType.Attribute("name")); + } + + [Fact] + public void CorePackageDependsOnApplicationArtifactsOnlyForWindows() + { + SetTestIdentifier(nameof(CorePackageDependsOnApplicationArtifactsOnlyForWindows)); + if (!TestEnvironment.IsWindows) + { + if (true) + return; // Skip: "Packing the Windows Core target framework is only supported on Windows CI." + } + + var coreProject = Path.Combine(TestEnvironment.GetMauiDirectory(), "src", "Core", "src", "Core.csproj"); + Assert.True( + DotnetInternal.Run( + "pack", + $"\"{coreProject}\" -c Debug --no-build --no-restore -p:Packing=true -p:EnableWindowsTargeting=true -p:IncludeBuildOutput=false -p:NoWarn=NU5127%3BNU5128 -p:PackageOutputPath=\"{TestDirectory}\" -v:minimal", + output: _output), + "Unable to generate the Core package dependency graph."); + var packagePath = Path.Combine(TestDirectory, $"Microsoft.Maui.Core.{MauiPackageVersion}.nupkg"); + Assert.True(File.Exists(packagePath), $"The expected Core package was not created at '{packagePath}'."); + + using var archive = ZipFile.OpenRead(packagePath); + var nuspecEntry = Assert.Single(archive.Entries.Where(entry => entry.FullName.EndsWith(".nuspec", StringComparison.OrdinalIgnoreCase))); + using var nuspecStream = nuspecEntry.Open(); + var nuspec = XDocument.Load(nuspecStream); + var ns = nuspec.Root!.Name.Namespace; + var dependencyGroups = nuspec + .Descendants(ns + "group") + .Where(group => group.Elements(ns + "dependency").Any(dependency => + string.Equals((string?)dependency.Attribute("id"), PackageId, StringComparison.Ordinal))) + .ToArray(); + + Assert.NotEmpty(dependencyGroups); + Assert.All(dependencyGroups, group => + { + Assert.Contains("windows", (string?)group.Attribute("targetFramework") ?? string.Empty, StringComparison.OrdinalIgnoreCase); + var dependency = Assert.Single(group.Elements(ns + "dependency").Where(candidate => + string.Equals((string?)candidate.Attribute("id"), PackageId, StringComparison.Ordinal))); + Assert.Equal("All", (string?)dependency.Attribute("include"), ignoreCase: true); + Assert.Null(dependency.Attribute("exclude")); + }); + } + + [Fact] + public void TargetsClassifyAndDeduplicateAuthoritativeOutputs() + { + SetTestIdentifier(nameof(TargetsClassifyAndDeduplicateAuthoritativeOutputs)); + var packageDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "AppPackages")).FullName; + var packageTestDir = Directory.CreateDirectory(Path.Combine(packageDir, "ArtifactApp_2.3.4.5_x64_Test")).FullName; + var targetDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "bin", "Debug", "net11.0-windows")).FullName; + var uploadDir = Directory.CreateDirectory(Path.Combine(targetDir, "Upload")).FullName; + var intermediateDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "obj", "Debug")).FullName; + + var primary = CreateFile(packageTestDir, "ArtifactApp_2.3.4.5_x64.msix"); + var bundle = CreateFile(packageTestDir, "ArtifactApp_2.3.4.5_x64.msixbundle"); + var uploadPackage = CreateFile(uploadDir, "ArtifactApp_2.3.4.5_x64.msix"); + var storeUpload = CreateFile(packageDir, "ArtifactApp_2.3.4.5_x64.msixupload"); + var appInstaller = CreateFile(packageDir, "ArtifactApp.appinstaller"); + var symbols = CreateFile(packageTestDir, "ArtifactApp_2.3.4.5_x64.appxsym"); + var certificate = CreateFile(packageTestDir, "ArtifactApp.cer"); + var installScript = CreateFile(packageTestDir, "Install.ps1"); + var dependency = CreateFile(Path.Combine(packageTestDir, "Dependencies", "x64"), "Framework.msix"); + var landingPage = CreateFile(packageDir, "index.html"); + var support = CreateFile(packageDir, "install.json"); + var appInstallerSupport = CreateFile(packageDir, "appinstaller-data.xml"); + var intermediate = CreateFile(intermediateDir, "intermediate.msix"); + _ = CreateFile(targetDir, "loose-payload.dll"); + + var manifest = Path.Combine(targetDir, "AppxManifest.xml"); + File.WriteAllText(manifest, """ + + + + + ms-resource:ArtifactApp + + + + + + """); + + var artifactsFile = Path.Combine(TestDirectory, "application-artifacts.txt"); + var projectFile = Path.Combine(TestDirectory, "ArtifactClassification.proj"); + var targetsFile = Path.Combine( + TestEnvironment.GetMauiDirectory(), + "src", + "Workload", + PackageId, + "buildTransitive", + $"{PackageId}.targets"); + + File.WriteAllText(projectFile, $""" + + + net11.0-windows10.0.19041.0 + WinExe + false + {Escape(packageDir)} + MSIX + {Escape(WithDirectorySeparator(targetDir))} + {Escape(WithDirectorySeparator(targetDir))} + {Escape(WithDirectorySeparator(intermediateDir))} + {Escape(WithDirectorySeparator(packageDir))} + {Escape(WithDirectorySeparator(packageTestDir))} + {Escape(WithDirectorySeparator(uploadDir))} + {Escape(primary)} + {Escape(bundle)} + {Escape(uploadPackage)} + {Escape(storeUpload)} + {Escape(symbols)} + {Escape(certificate)} + {Escape(landingPage)} + {Escape(manifest)} + x64 + win-x64 + true + x64_arm64 + ArtifactApp + StampCollectedArtifacts + + + + true + + + + + + + + + + + + + + + + + + extended-%(ApplicationArtifact.BundlePlatforms) + + + + + + + + """); + + Assert.True( + DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteApplicationArtifacts -v:minimal", output: _output), + "Unable to execute the Windows ApplicationArtifact targets contract fixture."); + + var artifacts = File.ReadAllLines(artifactsFile) + .Select(ArtifactRecord.Parse) + .ToArray(); + + Assert.Equal(13, artifacts.Length); + Assert.Equal(artifacts.Length, artifacts.Select(artifact => artifact.Path).Distinct(StringComparer.OrdinalIgnoreCase).Count()); + Assert.DoesNotContain(artifacts, artifact => artifact.Path.StartsWith(intermediateDir, StringComparison.OrdinalIgnoreCase)); + Assert.DoesNotContain(artifacts, artifact => artifact.Path.EndsWith("loose-payload.dll", StringComparison.OrdinalIgnoreCase)); + + AssertRole(primary, "Primary", isPrimary: true); + AssertRole(packageTestDir, "PayloadDirectory"); + AssertRole(bundle, "Bundle"); + AssertRole(uploadPackage, "StoreUpload"); + AssertRole(storeUpload, "StoreUpload"); + AssertRole(appInstaller, "DeploymentManifest"); + AssertRole(symbols, "Symbols"); + AssertRole(certificate, "Certificate"); + AssertRole(installScript, "InstallScript"); + AssertRole(dependency, "DependencyPackage"); + AssertRole(landingPage, "LandingPage"); + AssertRole(support, "Support"); + AssertRole(appInstallerSupport, "Support"); + + Assert.All(artifacts, artifact => + { + Assert.Equal("MSIX", artifact.PackageType); + Assert.Equal("2.3.4.5", artifact.PackageVersion); + Assert.Equal("x64", artifact.Architecture); + Assert.Equal("win-x64", artifact.RuntimeIdentifier); + Assert.Equal("true", artifact.Signed, ignoreCase: true); + Assert.Equal("extended-x64_arm64", artifact.BundlePlatforms); + Assert.Equal("ArtifactApp.exe", artifact.EntryPoint); + Assert.Equal( + Path.TrimEndingDirectorySeparator(Path.GetFullPath(packageTestDir)), + Path.TrimEndingDirectorySeparator(Path.GetFullPath(artifact.DeploymentDirectory))); + Assert.Equal("11111111-2222-3333-4444-555555555555", artifact.ApplicationId); + Assert.Equal(artifact.ApplicationId, artifact.ApplicationIdGuid); + Assert.Equal("ms-resource:ArtifactApp", artifact.ApplicationTitle); + Assert.Equal(artifact.ApplicationTitle, artifact.ApplicationName); + Assert.Equal("2.3.4", artifact.ApplicationDisplayVersion); + Assert.Equal("5", artifact.ApplicationVersion); + }); + + void AssertRole(string path, string role, bool isPrimary = false) + { + var artifact = Assert.Single(artifacts.Where(candidate => + string.Equals( + Path.TrimEndingDirectorySeparator(Path.GetFullPath(candidate.Path)), + Path.TrimEndingDirectorySeparator(Path.GetFullPath(path)), + StringComparison.OrdinalIgnoreCase))); + Assert.Equal(role, artifact.Role); + Assert.Equal(isPrimary ? "true" : "false", artifact.IsPrimary, ignoreCase: true); + Assert.Equal( + Path.GetFullPath(isPrimary ? path : primary), + Path.GetFullPath(artifact.PrimaryArtifact), + ignoreCase: true); + } + } + + [Theory] + [InlineData("net11.0", "WinExe", true, true, false, true)] + [InlineData("net11.0-windows10.0.19041.0", "Library", true, true, false, true)] + [InlineData("net11.0-windows10.0.19041.0", "WinExe", false, true, false, true)] + [InlineData("net11.0-windows10.0.19041.0", "WinExe", true, false, false, true)] + [InlineData("net11.0-windows10.0.19041.0", "WinExe", true, true, true, true)] + [InlineData("net11.0-windows10.0.19041.0", "WinExe", true, true, false, false)] + public void TargetsAreInertOutsideRealWindowsAppSdkApplications( + string targetFramework, + string outputType, + bool hasWindowsAppSdk, + bool enabled, + bool designTimeBuild, + bool buildingProject) + { + SetTestIdentifier(targetFramework, outputType, hasWindowsAppSdk, enabled, designTimeBuild, buildingProject); + var artifactsFile = Path.Combine(TestDirectory, "application-artifacts.txt"); + var projectFile = Path.Combine(TestDirectory, "Inert.proj"); + var targetsFile = Path.Combine( + TestEnvironment.GetMauiDirectory(), + "src", + "Workload", + PackageId, + "buildTransitive", + $"{PackageId}.targets"); + + File.WriteAllText(projectFile, $""" + + + {targetFramework} + {outputType} + {buildingProject} + {designTimeBuild} + {enabled} + {(hasWindowsAppSdk ? Escape(TestDirectory) : string.Empty)} + None + + + + + + + + """); + + Assert.True( + DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteApplicationArtifacts -v:minimal", output: _output), + "Unable to execute the inert Windows ApplicationArtifact fixture."); + Assert.True(!File.Exists(artifactsFile) || new FileInfo(artifactsFile).Length == 0); + } + + [Fact] + public void SparsePackageUsesTheFinalMsixAsPrimaryArtifact() + { + SetTestIdentifier(nameof(SparsePackageUsesTheFinalMsixAsPrimaryArtifact)); + var targetDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "bin")).FullName; + var sparsePackage = CreateFile(targetDir, "SparseApp.msix"); + var artifactsFile = Path.Combine(TestDirectory, "application-artifacts.txt"); + var projectFile = Path.Combine(TestDirectory, "Sparse.proj"); + var targetsFile = Path.Combine( + TestEnvironment.GetMauiDirectory(), + "src", + "Workload", + PackageId, + "buildTransitive", + $"{PackageId}.targets"); + + File.WriteAllText(projectFile, $""" + + + net11.0-windows10.0.19041.0 + WinExe + false + {Escape(TestDirectory)} + Sparse + {Escape(WithDirectorySeparator(targetDir))} + {Escape(sparsePackage)} + SparseApp + + + + true + + + + + + + + + + """); + + Assert.True( + DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteApplicationArtifacts -v:minimal", output: _output), + "Unable to execute the sparse Windows ApplicationArtifact fixture."); + + var fields = Assert.Single(File.ReadAllLines(artifactsFile)).Split('|'); + Assert.Equal(Path.GetFullPath(sparsePackage), Path.GetFullPath(fields[0]), ignoreCase: true); + Assert.Equal("Primary", fields[1]); + Assert.Equal("Sparse", fields[2]); + Assert.Equal("msix", fields[3]); + } + + [Fact] + public void UnpackagedBuildAndPublishUseTheirOwnOutputPaths() + { + SetTestIdentifier(nameof(UnpackagedBuildAndPublishUseTheirOwnOutputPaths)); + var targetDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "bin")).FullName; + var publishDir = Directory.CreateDirectory(Path.Combine(targetDir, "publish")).FullName; + var buildExecutable = CreateFile(targetDir, "UnpackagedApp.exe"); + var publishExecutable = CreateFile(publishDir, "UnpackagedApp.exe"); + var buildArtifactsFile = Path.Combine(TestDirectory, "build-application-artifacts.txt"); + var publishArtifactsFile = Path.Combine(TestDirectory, "publish-application-artifacts.txt"); + var projectFile = Path.Combine(TestDirectory, "Unpackaged.proj"); + var targetsFile = Path.Combine( + TestEnvironment.GetMauiDirectory(), + "src", + "Workload", + PackageId, + "buildTransitive", + $"{PackageId}.targets"); + + File.WriteAllText(projectFile, $""" + + + net11.0-windows10.0.19041.0 + WinExe + true + {Escape(TestDirectory)} + None + {Escape(WithDirectorySeparator(targetDir))} + {Escape(WithDirectorySeparator(publishDir))} + UnpackagedApp + UnpackagedApp + com.example.unpackaged + Unpackaged App + 1.2.3 + 4 + + + + + + + + + + + + + """); + + Assert.True( + DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteBuildApplicationArtifacts;Publish -v:minimal", output: _output), + "Unable to collect unpackaged build and publish artifacts in one MSBuild invocation."); + var sameInvocationPublishPrimary = Assert.Single(File.ReadAllLines(publishArtifactsFile).Where(line => line.EndsWith("|Primary", StringComparison.Ordinal))); + Assert.Equal(Path.GetFullPath(publishExecutable), Path.GetFullPath(sameInvocationPublishPrimary.Split('|')[0]), ignoreCase: true); + + File.Delete(buildArtifactsFile); + File.Delete(publishArtifactsFile); + + Assert.True( + DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteBuildApplicationArtifacts -v:minimal", output: _output), + "Unable to collect unpackaged build artifacts."); + var buildPrimary = Assert.Single(File.ReadAllLines(buildArtifactsFile).Where(line => line.EndsWith("|Primary", StringComparison.Ordinal))); + Assert.Equal(Path.GetFullPath(buildExecutable), Path.GetFullPath(buildPrimary.Split('|')[0]), ignoreCase: true); + + Assert.True( + DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:Publish -v:minimal", output: _output), + "Unable to collect unpackaged publish artifacts."); + var publishPrimary = Assert.Single(File.ReadAllLines(publishArtifactsFile).Where(line => line.EndsWith("|Primary", StringComparison.Ordinal))); + Assert.Equal(Path.GetFullPath(publishExecutable), Path.GetFullPath(publishPrimary.Split('|')[0]), ignoreCase: true); + } + + string FindPackage(string packageId) + { + var artifactDir = Path.Combine(TestEnvironment.GetMauiDirectory(), "artifacts"); + var matchingPackages = Directory + .GetFiles(artifactDir, $"{packageId}.{MauiPackageVersion}.nupkg", SearchOption.AllDirectories) + .Where(path => !path.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}", StringComparison.OrdinalIgnoreCase)) + .ToArray(); + + return Assert.Single(matchingPackages); + } + + static string CreateFile(string directory, string fileName) + { + Directory.CreateDirectory(directory); + var path = Path.Combine(directory, fileName); + File.WriteAllText(path, fileName); + return path; + } + + static string WithDirectorySeparator(string path) => + path.EndsWith(Path.DirectorySeparatorChar, StringComparison.Ordinal) ? path : path + Path.DirectorySeparatorChar; + + static string Escape(string value) => SecurityElement.Escape(value) ?? string.Empty; + + sealed record ArtifactRecord( + string Path, + string Role, + string IsPrimary, + string PrimaryArtifact, + string PackageFormat, + string PackageType, + string PackageVersion, + string Architecture, + string RuntimeIdentifier, + string Signed, + string BundlePlatforms, + string EntryPoint, + string DeploymentDirectory, + string ApplicationId, + string ApplicationIdGuid, + string ApplicationTitle, + string ApplicationName, + string ApplicationDisplayVersion, + string ApplicationVersion) + { + public static ArtifactRecord Parse(string line) + { + var fields = line.Split('|'); + Assert.Equal(19, fields.Length); + return new( + fields[0], + fields[1], + fields[2], + fields[3], + fields[4], + fields[5], + fields[6], + fields[7], + fields[8], + fields[9], + fields[10], + fields[11], + fields[12], + fields[13], + fields[14], + fields[15], + fields[16], + fields[17], + fields[18]); + } + } +} diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs index e0f434563117..78d345048908 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs @@ -1,4 +1,9 @@ -namespace Microsoft.Maui.IntegrationTests; +using System.Security; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using System.Xml.Linq; + +namespace Microsoft.Maui.IntegrationTests; [Trait("Category", "WindowsTemplates")] public class WindowsTemplateTest : BaseTemplateTests @@ -46,7 +51,8 @@ public void BuildWindowsAppSDKSelfContained(string id, bool wasdkself, bool nets SetTestIdentifier(id, wasdkself, netself, packageType); if (TestEnvironment.IsMacOS) { - if (true) return; // Skip: "This test is designed for testing a windows build." + if (true) + return; // Skip: "This test is designed for testing a windows build." } var projectDir = TestDirectory; @@ -80,7 +86,8 @@ public void BuildWindowsRidGraph(string id, bool useRidGraph, string packageType SetTestIdentifier(id, useRidGraph, packageType); if (TestEnvironment.IsMacOS) { - if (true) return; // Skip: "This test is designed for testing a windows build." + if (true) + return; // Skip: "This test is designed for testing a windows build." } var projectDir = TestDirectory; @@ -113,7 +120,8 @@ public void PublishUnpackaged(string id, string framework, string config, bool u SetTestIdentifier(id, framework, config, usesRidGraph); if (!TestEnvironment.IsWindows) { - if (true) return; // Skip: "Running Windows templates is only supported on Windows." + if (true) + return; // Skip: "Running Windows templates is only supported on Windows." } var projectDir = TestDirectory; @@ -160,7 +168,8 @@ public void PublishPackaged(string id, string framework, string config) SetTestIdentifier(id, framework, config); if (!TestEnvironment.IsWindows) { - if (true) return; // Skip: "Running Windows templates is only supported on Windows." + if (true) + return; // Skip: "Running Windows templates is only supported on Windows." } var projectDir = TestDirectory; @@ -214,4 +223,281 @@ public void BuildWithIdentityClient() Assert.True(DotnetInternal.Build(projectFile, "Debug", properties: BuildProps, msbuildWarningsAsErrors: true, output: _output), $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); } + + [Theory] + [InlineData("None")] + [InlineData("MSIX")] + public void ApplicationArtifactsAreAvailableForMauiBuildAndPublish(string packageType) + { + SetTestIdentifier(packageType); + if (!TestEnvironment.IsWindows) + { + if (true) + return; // Skip: "Running Windows templates is only supported on Windows." + } + + var projectDir = TestDirectory; + var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); + var buildArtifactsFile = Path.Combine(projectDir, "build-application-artifacts.txt"); + var publishArtifactsFile = Path.Combine(projectDir, "publish-application-artifacts.txt"); + + Assert.True(DotnetInternal.New("maui", projectDir, DotNetCurrent, output: _output), + "Unable to create the MAUI template. Check test output for errors."); + + var signingProperties = string.Empty; + if (packageType == "MSIX") + { + const string certificatePassword = "application-artifacts-test"; + var certificatePath = Path.Combine(projectDir, "ApplicationArtifactsTest.pfx"); + CreateSigningCertificate(certificatePath, certificatePassword); + signingProperties = $""" + true + true + true + {Escape(certificatePath)} + {certificatePassword} + """; + } + + FileUtilities.ReplaceInFile( + projectFile, + "None", + $""" + {packageType} + {signingProperties} + """); + AddApplicationArtifactWriters(projectFile, buildArtifactsFile, publishArtifactsFile); + + var framework = $"{DotNetCurrent}-windows10.0.19041.0"; + Assert.True( + DotnetInternal.Build(projectFile, "Debug", target: "WriteBuildApplicationArtifacts", framework: framework, properties: BuildProps, output: _output), + "The MAUI project failed to collect build ApplicationArtifact items."); + AssertApplicationArtifacts(File.ReadAllLines(buildArtifactsFile), packageType, published: false); + + Assert.True( + DotnetInternal.Publish(projectFile, "Debug", framework: framework, properties: BuildProps, output: _output), + "The MAUI project failed to publish."); + AssertApplicationArtifacts(File.ReadAllLines(publishArtifactsFile), packageType, published: true); + } + + [Fact] + public void ApplicationArtifactsIncludeBundleStoreUploadAndAppInstaller() + { + SetTestIdentifier(nameof(ApplicationArtifactsIncludeBundleStoreUploadAndAppInstaller)); + if (!TestEnvironment.IsWindows) + { + if (true) + return; // Skip: "Running Windows templates is only supported on Windows." + } + + const string certificatePassword = "application-artifacts-test"; + var projectDir = TestDirectory; + var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); + var certificatePath = Path.Combine(projectDir, "ApplicationArtifactsTest.pfx"); + var publishArtifactsFile = Path.Combine(projectDir, "publish-application-artifacts.txt"); + + Assert.True(DotnetInternal.New("maui", projectDir, DotNetCurrent, output: _output), + "Unable to create the MAUI template. Check test output for errors."); + + CreateSigningCertificate(certificatePath, certificatePassword); + FileUtilities.ReplaceInFile( + projectFile, + "None", + $""" + MSIX + true + true + true + {Escape(certificatePath)} + {certificatePassword} + StoreAndSideload + Always + x64 + true + https://example.invalid/application-artifacts/ + 0 + """); + AddApplicationArtifactWriters(projectFile, Path.Combine(projectDir, "build-application-artifacts.txt"), publishArtifactsFile); + + var framework = $"{DotNetCurrent}-windows10.0.19041.0"; + Assert.True( + DotnetInternal.Publish(projectFile, "Release", framework: framework, properties: BuildProps, output: _output), + "The MAUI project failed to produce the Windows packaging output matrix."); + + var artifactLines = File.ReadAllLines(publishArtifactsFile); + var artifacts = artifactLines.Select(WindowsArtifact.Parse).ToArray(); + AssertApplicationArtifacts(artifactLines, "MSIX", published: true); + Assert.Contains(artifacts, artifact => artifact.Role == "Bundle" && artifact.Path.EndsWith(".msixbundle", StringComparison.OrdinalIgnoreCase)); + Assert.Contains(artifacts, artifact => artifact.Role == "StoreUpload" && artifact.Path.EndsWith(".msixupload", StringComparison.OrdinalIgnoreCase)); + Assert.Contains(artifacts, artifact => artifact.Role == "DeploymentManifest" && artifact.Path.EndsWith(".appinstaller", StringComparison.OrdinalIgnoreCase)); + } + + [Fact] + public void StandaloneWindowsAppSdkApplicationCanReferenceApplicationArtifactsPackage() + { + SetTestIdentifier(nameof(StandaloneWindowsAppSdkApplicationCanReferenceApplicationArtifactsPackage)); + if (!TestEnvironment.IsWindows) + { + if (true) + return; // Skip: "Running Windows templates is only supported on Windows." + } + + var projectDir = TestDirectory; + var projectFile = Path.Combine(projectDir, "StandaloneWindowsApp.csproj"); + var buildArtifactsFile = Path.Combine(projectDir, "build-application-artifacts.txt"); + var publishArtifactsFile = Path.Combine(projectDir, "publish-application-artifacts.txt"); + var windowsAppSdkVersion = GetWindowsAppSdkPackageVersion(); + + File.WriteAllText(Path.Combine(projectDir, "Program.cs"), """ + namespace StandaloneWindowsApp; + + internal static class Program + { + [STAThread] + static void Main() + { + } + } + """); + File.WriteAllText(projectFile, $""" + + + {DotNetCurrent}-windows10.0.19041.0 + WinExe + win-x64 + None + com.example.standalonewindowsapp + Standalone Windows App + 7.8.9 + 10 + + + + + + {GetApplicationArtifactWriters(buildArtifactsFile, publishArtifactsFile)} + + """); + + Assert.True( + DotnetInternal.Build(projectFile, "Debug", target: "WriteBuildApplicationArtifacts", properties: BuildProps, output: _output), + "The standalone Windows App SDK project failed to collect build ApplicationArtifact items."); + AssertApplicationArtifacts(File.ReadAllLines(buildArtifactsFile), "None", published: false); + + Assert.True( + DotnetInternal.Publish(projectFile, "Debug", properties: BuildProps, output: _output), + "The standalone Windows App SDK project failed to publish."); + AssertApplicationArtifacts(File.ReadAllLines(publishArtifactsFile), "None", published: true); + + var assetsFile = File.ReadAllText(Path.Combine(projectDir, "obj", "project.assets.json")); + Assert.DoesNotContain("Microsoft.Maui.Core/", assetsFile, StringComparison.OrdinalIgnoreCase); + Assert.DoesNotContain("Microsoft.Maui.Resizetizer/", assetsFile, StringComparison.OrdinalIgnoreCase); + } + + static void AddApplicationArtifactWriters(string projectFile, string buildArtifactsFile, string publishArtifactsFile) + { + FileUtilities.ReplaceInFile( + projectFile, + "", + $""" + {GetApplicationArtifactWriters(buildArtifactsFile, publishArtifactsFile)} + + """); + } + + static string GetApplicationArtifactWriters(string buildArtifactsFile, string publishArtifactsFile) => $""" + + + + + + + """; + + static void AssertApplicationArtifacts(string[] artifactLines, string packageType, bool published) + { + var artifacts = artifactLines.Select(WindowsArtifact.Parse).ToArray(); + Assert.NotEmpty(artifacts); + Assert.Equal(artifacts.Length, artifacts.Select(artifact => artifact.Path).Distinct(StringComparer.OrdinalIgnoreCase).Count()); + Assert.DoesNotContain(artifacts, artifact => + artifact.Path.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}", StringComparison.OrdinalIgnoreCase)); + Assert.All(artifacts, artifact => + { + Assert.False(string.IsNullOrWhiteSpace(artifact.Role)); + Assert.False(string.IsNullOrWhiteSpace(artifact.Format)); + Assert.Equal(packageType, artifact.PackageType, ignoreCase: true); + Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationId)); + Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationTitle)); + Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationDisplayVersion)); + Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationVersion)); + }); + + var primary = Assert.Single(artifacts.Where(artifact => artifact.Role == "Primary")); + Assert.Equal(packageType == "None" ? "exe" : "msix", primary.Format, ignoreCase: true); + if (published && packageType == "None") + Assert.Contains($"{Path.DirectorySeparatorChar}publish{Path.DirectorySeparatorChar}", primary.Path, StringComparison.OrdinalIgnoreCase); + + Assert.Contains(artifacts, artifact => artifact.Role == "PayloadDirectory"); + if (packageType == "MSIX") + { + Assert.Equal("true", primary.Signed, ignoreCase: true); + Assert.False(string.IsNullOrWhiteSpace(primary.PackageVersion)); + Assert.Contains(artifacts, artifact => artifact.Role == "Certificate"); + Assert.Contains(artifacts, artifact => artifact.Role == "InstallScript"); + } + else + { + Assert.Equal("false", primary.Signed, ignoreCase: true); + } + } + + static void CreateSigningCertificate(string path, string password) + { + using var rsa = RSA.Create(2048); + var request = new CertificateRequest("CN=User Name", rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + request.CertificateExtensions.Add(new X509BasicConstraintsExtension(false, false, 0, false)); + request.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.DigitalSignature, false)); + var enhancedKeyUsages = new OidCollection + { + new Oid("1.3.6.1.5.5.7.3.3") + }; + request.CertificateExtensions.Add(new X509EnhancedKeyUsageExtension(enhancedKeyUsages, false)); + using var certificate = request.CreateSelfSigned(DateTimeOffset.UtcNow.AddDays(-1), DateTimeOffset.UtcNow.AddDays(30)); + File.WriteAllBytes(path, certificate.Export(X509ContentType.Pfx, password)); + } + + static string GetWindowsAppSdkPackageVersion() + { + var versionsFile = Path.Combine(TestEnvironment.GetMauiDirectory(), "eng", "Versions.props"); + var versions = XDocument.Load(versionsFile); + return versions.Descendants("MicrosoftWindowsAppSDKPackageVersion").Single().Value; + } + + static string Escape(string value) => SecurityElement.Escape(value) ?? string.Empty; + + sealed record WindowsArtifact( + string Path, + string Role, + string Format, + string PackageType, + string PackageVersion, + string Signed, + string ApplicationId, + string ApplicationTitle, + string ApplicationDisplayVersion, + string ApplicationVersion) + { + public static WindowsArtifact Parse(string line) + { + var fields = line.Split('|'); + Assert.Equal(10, fields.Length); + return new(fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], fields[6], fields[7], fields[8], fields[9]); + } + } } diff --git a/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj b/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj new file mode 100644 index 000000000000..b9d882dd3869 --- /dev/null +++ b/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj @@ -0,0 +1,21 @@ + + + + + + true + false + Dependency + Microsoft.Maui.ApplicationArtifacts.Windows + Windows Application Artifacts + MSBuild targets that expose final Windows App SDK application outputs through the ApplicationArtifact item. + + + + + + + diff --git a/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets b/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets new file mode 100644 index 000000000000..ded8fdfd38ff --- /dev/null +++ b/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets @@ -0,0 +1,490 @@ + + + + <_MicrosoftMauiWindowsApplicationArtifactsEnabled + Condition="'$(EnableWindowsApplicationArtifacts)' != 'false' + and '$(MicrosoftWindowsAppSDKPackageDir)' != '' + and '$(MSBuildProjectExtension)' != '.wapproj' + and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' + and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true + + + _CollectMicrosoftMauiWindowsApplicationArtifacts; + $(GetApplicationArtifactsDependsOn) + + + + + + + + + + + + + + + <_MicrosoftMauiWindowsCollectingForPublish>true + + + + + + + + + + + <_MicrosoftMauiWindowsPrimaryArtifact>$([System.IO.Path]::GetFullPath('$(PublishDir)$(TargetName).exe')) + <_MicrosoftMauiWindowsDeploymentDirectory>$([System.IO.Path]::GetFullPath('$(PublishDir)')) + + + + + + + Primary + true + $(_MicrosoftMauiWindowsPrimaryArtifact) + exe + $(WindowsPackageType) + $(_MicrosoftMauiWindowsPackageVersion) + $(_MicrosoftMauiWindowsArchitecture) + $(RuntimeIdentifier) + $(_MicrosoftMauiWindowsSigned) + $(AppxBundlePlatforms) + $(_MicrosoftMauiWindowsEntryPoint) + $(_MicrosoftMauiWindowsDeploymentDirectory) + $(_MicrosoftMauiWindowsApplicationId) + $(_MicrosoftMauiWindowsApplicationIdGuid) + $(_MicrosoftMauiWindowsApplicationTitle) + $(_MicrosoftMauiWindowsApplicationName) + $(_MicrosoftMauiWindowsApplicationDisplayVersion) + $(_MicrosoftMauiWindowsApplicationVersion) + <_MicrosoftMauiWindowsApplicationArtifact>true + + + + PayloadDirectory + false + $(_MicrosoftMauiWindowsPrimaryArtifact) + directory + $(WindowsPackageType) + $(_MicrosoftMauiWindowsPackageVersion) + $(_MicrosoftMauiWindowsArchitecture) + $(RuntimeIdentifier) + $(_MicrosoftMauiWindowsSigned) + $(AppxBundlePlatforms) + $(_MicrosoftMauiWindowsEntryPoint) + $(_MicrosoftMauiWindowsDeploymentDirectory) + $(_MicrosoftMauiWindowsApplicationId) + $(_MicrosoftMauiWindowsApplicationIdGuid) + $(_MicrosoftMauiWindowsApplicationTitle) + $(_MicrosoftMauiWindowsApplicationName) + $(_MicrosoftMauiWindowsApplicationDisplayVersion) + $(_MicrosoftMauiWindowsApplicationVersion) + <_MicrosoftMauiWindowsApplicationArtifact>true + + + + + + + + + <_MicrosoftMauiWindowsApplicationArtifactRaw Remove="@(_MicrosoftMauiWindowsApplicationArtifactRaw)" /> + <_MicrosoftMauiWindowsReportedOutput Remove="@(_MicrosoftMauiWindowsReportedOutput)" /> + <_MicrosoftMauiWindowsApplicationArtifactNormalized Remove="@(_MicrosoftMauiWindowsApplicationArtifactNormalized)" /> + <_MicrosoftMauiWindowsApplicationArtifactDistinct Remove="@(_MicrosoftMauiWindowsApplicationArtifactDistinct)" /> + + + + + + + + + + + + + + + + + + + + <_MicrosoftMauiWindowsPackageVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestVersion)' != ''">$(_MicrosoftMauiWindowsManifestVersion) + <_MicrosoftMauiWindowsPackageVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsPackageVersion)' == ''">$(AppxManifestIdentityVersion) + + <_MicrosoftMauiWindowsApplicationId Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestIdentity)' != ''">$(_MicrosoftMauiWindowsManifestIdentity) + <_MicrosoftMauiWindowsApplicationId Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsApplicationId)' == '' and '$(AppxManifestIdentityName)' != ''">$(AppxManifestIdentityName) + <_MicrosoftMauiWindowsApplicationId Condition="'$(_MicrosoftMauiWindowsApplicationId)' == '' and '$(ApplicationId)' != ''">$(ApplicationId) + <_MicrosoftMauiWindowsApplicationId Condition="'$(_MicrosoftMauiWindowsApplicationId)' == ''">$(AssemblyName) + + <_MicrosoftMauiWindowsApplicationTitle Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestDisplayName)' != ''">$(_MicrosoftMauiWindowsManifestDisplayName) + <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == '' and '$(ApplicationTitle)' != ''">$(ApplicationTitle) + <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == '' and '$(ApplicationName)' != ''">$(ApplicationName) + <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == '' and '$(AssemblyTitle)' != ''">$(AssemblyTitle) + <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == ''">$(AssemblyName) + + <_MicrosoftMauiWindowsApplicationName Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestDisplayName)' != ''">$(_MicrosoftMauiWindowsManifestDisplayName) + <_MicrosoftMauiWindowsApplicationName Condition="'$(_MicrosoftMauiWindowsApplicationName)' == '' and '$(ApplicationName)' != ''">$(ApplicationName) + <_MicrosoftMauiWindowsApplicationName Condition="'$(_MicrosoftMauiWindowsApplicationName)' == '' and '$(ApplicationTitle)' != ''">$(ApplicationTitle) + <_MicrosoftMauiWindowsApplicationName Condition="'$(_MicrosoftMauiWindowsApplicationName)' == ''">$(AssemblyName) + + <_MicrosoftMauiWindowsApplicationDisplayVersion + Condition="'$(WindowsPackageType)' != 'None' + and $([System.Text.RegularExpressions.Regex]::IsMatch('$(_MicrosoftMauiWindowsPackageVersion)', '^\d+\.\d+\.\d+\.\d+$'))">$([System.Text.RegularExpressions.Regex]::Replace('$(_MicrosoftMauiWindowsPackageVersion)', '^(\d+\.\d+\.\d+)\.(\d+)$', '$1')) + <_MicrosoftMauiWindowsApplicationVersion + Condition="'$(WindowsPackageType)' != 'None' + and $([System.Text.RegularExpressions.Regex]::IsMatch('$(_MicrosoftMauiWindowsPackageVersion)', '^\d+\.\d+\.\d+\.\d+$'))">$([System.Text.RegularExpressions.Regex]::Replace('$(_MicrosoftMauiWindowsPackageVersion)', '^(\d+\.\d+\.\d+)\.(\d+)$', '$2')) + <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsApplicationDisplayVersion)' == ''">$(_MicrosoftMauiWindowsPackageVersion) + <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsApplicationVersion)' == ''">$(ApplicationVersion) + + <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(ApplicationDisplayVersion)' != ''">$(ApplicationDisplayVersion) + <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationDisplayVersion)' == '' and '$(InformationalVersion)' != ''">$(InformationalVersion) + <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationDisplayVersion)' == ''">$(Version) + <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(ApplicationVersion)' != ''">$(ApplicationVersion) + <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationVersion)' == '' and '$(FileVersion)' != ''">$(FileVersion) + <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationVersion)' == ''">$(AssemblyVersion) + + <_MicrosoftMauiWindowsApplicationIdGuid + Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(_MicrosoftMauiWindowsApplicationId)', '^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}|\{[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\}|[0-9a-fA-F]{32})$'))">$(_MicrosoftMauiWindowsApplicationId) + + <_MicrosoftMauiWindowsArchitecture Condition="'$(PackageArchitecture)' != ''">$(PackageArchitecture) + <_MicrosoftMauiWindowsArchitecture Condition="'$(_MicrosoftMauiWindowsArchitecture)' == '' and '$(PlatformTarget)' != ''">$(PlatformTarget) + <_MicrosoftMauiWindowsArchitecture Condition="'$(_MicrosoftMauiWindowsArchitecture)' == ''">$(Platform) + <_MicrosoftMauiWindowsSigned Condition="'$(WindowsPackageType)' == 'None'">false + <_MicrosoftMauiWindowsSigned Condition="'$(_MicrosoftMauiWindowsSigned)' == '' and '$(AppxPackageSigningEnabled)' != ''">$(AppxPackageSigningEnabled) + <_MicrosoftMauiWindowsSigned Condition="'$(_MicrosoftMauiWindowsSigned)' == ''">false + + <_MicrosoftMauiWindowsEntryPoint Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestExecutable)' != ''">$(_MicrosoftMauiWindowsManifestExecutable) + <_MicrosoftMauiWindowsEntryPoint Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsEntryPoint)' == ''">$(_MicrosoftMauiWindowsManifestEntryPoint) + <_MicrosoftMauiWindowsEntryPoint Condition="'$(WindowsPackageType)' == 'None'">$(TargetName).exe + + + + <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(AppxPackageOutput)' != '' and Exists('$(AppxPackageOutput)')">$([System.IO.Path]::GetFullPath('$(AppxPackageOutput)')) + <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(_MicrosoftMauiWindowsPrimaryArtifact)' == '' and '$(AppxMainPackageOutput)' != '' and Exists('$(AppxMainPackageOutput)')">$([System.IO.Path]::GetFullPath('$(AppxMainPackageOutput)')) + <_MicrosoftMauiWindowsDeploymentDirectory Condition="'$(AppxPackageTestDir)' != '' and Exists('$(AppxPackageTestDir)')">$([System.IO.Path]::GetFullPath('$(AppxPackageTestDir)')) + + + + <_MicrosoftMauiWindowsPublishExecutable>$(PublishDir)$(TargetName).exe + <_MicrosoftMauiWindowsPublishExecutable Condition="!Exists('$(_MicrosoftMauiWindowsPublishExecutable)')">$(PublishDir)$(AssemblyName).exe + <_MicrosoftMauiWindowsBuildExecutable>$(TargetDir)$(TargetName).exe + <_MicrosoftMauiWindowsTargetPathExtension Condition="'$(TargetPath)' != ''">$([System.IO.Path]::GetExtension('$(TargetPath)')) + <_MicrosoftMauiWindowsBuildExecutable Condition="!Exists('$(_MicrosoftMauiWindowsBuildExecutable)') and '$(TargetPath)' != '' and '$(_MicrosoftMauiWindowsTargetPathExtension)' == '.exe'">$(TargetPath) + <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(_MicrosoftMauiWindowsCollectingForPublish)' == 'true' and '$(PublishDir)' != '' and Exists('$(_MicrosoftMauiWindowsPublishExecutable)')">$([System.IO.Path]::GetFullPath('$(_MicrosoftMauiWindowsPublishExecutable)')) + <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(_MicrosoftMauiWindowsPrimaryArtifact)' == '' and Exists('$(_MicrosoftMauiWindowsBuildExecutable)')">$([System.IO.Path]::GetFullPath('$(_MicrosoftMauiWindowsBuildExecutable)')) + <_MicrosoftMauiWindowsDeploymentDirectory Condition="'$(_MicrosoftMauiWindowsCollectingForPublish)' == 'true' and '$(PublishDir)' != '' and Exists('$(PublishDir)')">$([System.IO.Path]::GetFullPath('$(PublishDir)')) + <_MicrosoftMauiWindowsDeploymentDirectory Condition="'$(_MicrosoftMauiWindowsDeploymentDirectory)' == '' and '$(TargetDir)' != '' and Exists('$(TargetDir)')">$([System.IO.Path]::GetFullPath('$(TargetDir)')) + + + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxPackageOutput)" + Condition="'$(AppxPackageOutput)' != '' and Exists('$(AppxPackageOutput)')" + ArtifactRole="Primary" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxMainPackageOutput)" + Condition="'$(AppxMainPackageOutput)' != '' and Exists('$(AppxMainPackageOutput)')" + ArtifactRole="Primary" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxPackageItem)" + Condition="Exists('%(FinalAppxPackageItem.Identity)')" + ArtifactRole="Primary" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxPackageTestDir)" + Condition="'$(AppxPackageTestDir)' != '' and Exists('$(AppxPackageTestDir)')" + ArtifactRole="PayloadDirectory" + PackageFormat="directory" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxBundleOutput)" + Condition="'$(AppxBundleOutput)' != '' and Exists('$(AppxBundleOutput)')" + ArtifactRole="Bundle" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadBundleOutput)" + Condition="'$(AppxUploadBundleOutput)' != '' and Exists('$(AppxUploadBundleOutput)')" + ArtifactRole="Bundle" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxStoreContainer)" + Condition="'$(AppxStoreContainer)' != '' and Exists('$(AppxStoreContainer)')" + ArtifactRole="StoreUpload" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadPackageOutput)" + Condition="'$(AppxUploadPackageOutput)' != '' and Exists('$(AppxUploadPackageOutput)')" + ArtifactRole="StoreUpload" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadMainPackageOutput)" + Condition="'$(AppxUploadMainPackageOutput)' != '' and Exists('$(AppxUploadMainPackageOutput)')" + ArtifactRole="StoreUpload" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxUploadPackageItem)" + Condition="Exists('%(FinalAppxUploadPackageItem.Identity)')" + ArtifactRole="StoreUpload" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(AppInstallerFilePath)" + Condition="Exists('%(AppInstallerFilePath.Identity)')" + ArtifactRole="DeploymentManifest" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxSymbolPackageOutput)" + Condition="'$(AppxSymbolPackageOutput)' != '' and Exists('$(AppxSymbolPackageOutput)')" + ArtifactRole="Symbols" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadSymbolPackageOutput)" + Condition="'$(AppxUploadSymbolPackageOutput)' != '' and Exists('$(AppxUploadSymbolPackageOutput)')" + ArtifactRole="Symbols" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxSymbolPackageItem)" + Condition="Exists('%(FinalAppxSymbolPackageItem.Identity)')" + ArtifactRole="Symbols" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxUploadSymbolPackageItem)" + Condition="Exists('%(FinalAppxUploadSymbolPackageItem.Identity)')" + ArtifactRole="Symbols" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxPackagePublicKeyFile)" + Condition="'$(AppxPackagePublicKeyFile)' != '' and Exists('$(AppxPackagePublicKeyFile)')" + ArtifactRole="Certificate" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(LandingPagePath)" + Condition="'$(LandingPagePath)' != '' and Exists('$(LandingPagePath)')" + ArtifactRole="LandingPage" /> + + + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(_MicrosoftMauiWindowsPrimaryArtifact)" + Condition="'$(_MicrosoftMauiWindowsPrimaryArtifact)' != ''" + ArtifactRole="Primary" + PackageFormat="exe" /> + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(_MicrosoftMauiWindowsDeploymentDirectory)" + Condition="'$(_MicrosoftMauiWindowsDeploymentDirectory)' != ''" + ArtifactRole="PayloadDirectory" + PackageFormat="directory" /> + + + + <_MicrosoftMauiWindowsApplicationArtifactTargetDir Condition="'$(TargetDir)' != ''">$([System.IO.Path]::GetFullPath('$(TargetDir)')) + <_MicrosoftMauiWindowsApplicationArtifactTargetDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactTargetDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactTargetDir)')) + <_MicrosoftMauiWindowsApplicationArtifactTargetDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactTargetDir.ToLowerInvariant()) + + <_MicrosoftMauiWindowsApplicationArtifactOutDir Condition="'$(OutDir)' != ''">$([System.IO.Path]::GetFullPath('$(OutDir)')) + <_MicrosoftMauiWindowsApplicationArtifactOutDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactOutDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactOutDir)')) + <_MicrosoftMauiWindowsApplicationArtifactOutDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactOutDir.ToLowerInvariant()) + + <_MicrosoftMauiWindowsApplicationArtifactPublishDir Condition="'$(PublishDir)' != ''">$([System.IO.Path]::GetFullPath('$(PublishDir)')) + <_MicrosoftMauiWindowsApplicationArtifactPublishDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPublishDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactPublishDir)')) + <_MicrosoftMauiWindowsApplicationArtifactPublishDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactPublishDir.ToLowerInvariant()) + + <_MicrosoftMauiWindowsApplicationArtifactPackageDir Condition="'$(AppxPackageDir)' != ''">$([System.IO.Path]::GetFullPath('$(AppxPackageDir)')) + <_MicrosoftMauiWindowsApplicationArtifactPackageDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactPackageDir)')) + <_MicrosoftMauiWindowsApplicationArtifactPackageDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactPackageDir.ToLowerInvariant()) + + <_MicrosoftMauiWindowsApplicationArtifactPackageTestDir Condition="'$(AppxPackageTestDir)' != ''">$([System.IO.Path]::GetFullPath('$(AppxPackageTestDir)')) + <_MicrosoftMauiWindowsApplicationArtifactPackageTestDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDir)')) + <_MicrosoftMauiWindowsApplicationArtifactPackageTestDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDir.ToLowerInvariant()) + + <_MicrosoftMauiWindowsApplicationArtifactUploadDir Condition="'$(AppxUploadPackageDir)' != ''">$([System.IO.Path]::GetFullPath('$(AppxUploadPackageDir)')) + <_MicrosoftMauiWindowsApplicationArtifactUploadDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactUploadDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactUploadDir)')) + <_MicrosoftMauiWindowsApplicationArtifactUploadDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactUploadDir.ToLowerInvariant()) + + <_MicrosoftMauiWindowsApplicationArtifactIntermediateDir Condition="'$(IntermediateOutputPath)' != ''">$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)')) + <_MicrosoftMauiWindowsApplicationArtifactIntermediateDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDir)')) + <_MicrosoftMauiWindowsApplicationArtifactIntermediateDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDir.ToLowerInvariant()) + + + + <_MicrosoftMauiWindowsReportedOutput Include="@(InstallerFileWrites)"> + <_Source>InstallerFileWrites + + <_MicrosoftMauiWindowsReportedOutput Include="@(PackagingFileWrites)"> + <_Source>PackagingFileWrites + + <_MicrosoftMauiWindowsReportedOutput Include="@(AllBuiltSideloadPackages)"> + <_Source>AllBuiltSideloadPackages + + <_MicrosoftMauiWindowsReportedOutput Include="@(AllBuiltUploadPackages)"> + <_Source>AllBuiltUploadPackages + + <_MicrosoftMauiWindowsReportedOutput Include="@(AppInstallerFileWrites)"> + <_Source>AppInstallerFileWrites + + + <_MicrosoftMauiWindowsReportedOutput Update="@(_MicrosoftMauiWindowsReportedOutput)"> + <_ComparablePath>$([System.String]::Copy('%(FullPath)').ToLowerInvariant()) + <_ExtensionLower>$([System.String]::Copy('%(Extension)').ToLowerInvariant()) + <_IsFinalOutput>false + <_IsIntermediateOutput>false + + <_MicrosoftMauiWindowsReportedOutput Update="@(_MicrosoftMauiWindowsReportedOutput)"> + <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactTargetDirComparable)' != '' + and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactTargetDirComparable)'))">true + <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactOutDirComparable)' != '' + and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactOutDirComparable)'))">true + <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPublishDirComparable)' != '' + and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactPublishDirComparable)'))">true + <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageDirComparable)' != '' + and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactPackageDirComparable)'))">true + <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDirComparable)' != '' + and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDirComparable)'))">true + <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactUploadDirComparable)' != '' + and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactUploadDirComparable)'))">true + <_IsIntermediateOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDirComparable)' != '' + and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDirComparable)'))">true + + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') + and ('%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.msixbundle' + or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appxbundle')" + ArtifactRole="Bundle" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') + and ('%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.msixupload' + or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appxupload' + or ('%(_MicrosoftMauiWindowsReportedOutput._Source)' == 'AllBuiltUploadPackages' + and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' != '.msixbundle' + and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' != '.appxbundle'))" + ArtifactRole="StoreUpload" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') + and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appinstaller'" + ArtifactRole="DeploymentManifest" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') + and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appxsym'" + ArtifactRole="Symbols" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') + and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.cer'" + ArtifactRole="Certificate" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') + and ('%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.ps1' + or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.psd1' + or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.cmd' + or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.bat')" + ArtifactRole="InstallScript" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') + and ($([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').Contains('\dependencies\')) + or $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').Contains('/dependencies/')))" + ArtifactRole="DependencyPackage" /> + + <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" + Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' + and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' + and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)')" + ArtifactRole="Support" /> + + + + <_MicrosoftMauiWindowsApplicationArtifactRaw Update="@(_MicrosoftMauiWindowsApplicationArtifactRaw)" + Condition="'%(_MicrosoftMauiWindowsApplicationArtifactRaw.PackageFormat)' == '' + and '%(_MicrosoftMauiWindowsApplicationArtifactRaw.Extension)' != ''"> + $([System.String]::Copy('%(_MicrosoftMauiWindowsApplicationArtifactRaw.Extension)').TrimStart('.').ToLowerInvariant()) + + <_MicrosoftMauiWindowsApplicationArtifactRaw Update="@(_MicrosoftMauiWindowsApplicationArtifactRaw)" + Condition="'%(_MicrosoftMauiWindowsApplicationArtifactRaw.PackageFormat)' == ''"> + file + + + <_MicrosoftMauiWindowsApplicationArtifactNormalized + Include="@(_MicrosoftMauiWindowsApplicationArtifactRaw->'%(FullPath)')" + KeepMetadata="ArtifactRole;PackageFormat" /> + + + + + + + + + %(_MicrosoftMauiWindowsApplicationArtifactDistinct.ArtifactRole) + true + false + %(_MicrosoftMauiWindowsApplicationArtifactDistinct.Identity) + $(_MicrosoftMauiWindowsPrimaryArtifact) + %(_MicrosoftMauiWindowsApplicationArtifactDistinct.PackageFormat) + $(WindowsPackageType) + $(_MicrosoftMauiWindowsPackageVersion) + $(_MicrosoftMauiWindowsArchitecture) + $(RuntimeIdentifier) + $(_MicrosoftMauiWindowsSigned) + $(AppxBundlePlatforms) + $(_MicrosoftMauiWindowsEntryPoint) + $(_MicrosoftMauiWindowsDeploymentDirectory) + $(_MicrosoftMauiWindowsApplicationId) + $(_MicrosoftMauiWindowsApplicationIdGuid) + $(_MicrosoftMauiWindowsApplicationTitle) + $(_MicrosoftMauiWindowsApplicationName) + $(_MicrosoftMauiWindowsApplicationDisplayVersion) + $(_MicrosoftMauiWindowsApplicationVersion) + <_MicrosoftMauiWindowsApplicationArtifact>true + + + + + diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets index 0a69d9303f3e..c63be6442e01 100644 --- a/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets +++ b/src/Workload/Microsoft.Maui.Sdk/Sdk/Microsoft.Maui.Sdk.After.targets @@ -13,17 +13,6 @@ - - - $(ApplicationId) - $(ApplicationIdGuid) - $(ApplicationTitle) - $(ApplicationTitle) - $(ApplicationDisplayVersion) - $(ApplicationVersion) - - - diff --git a/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json b/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json index 832cba86cb96..819cb6573140 100644 --- a/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json +++ b/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json @@ -73,6 +73,7 @@ "description": ".NET MAUI SDK for Windows", "extends": [ "maui-blazor" ], "packs": [ + "Microsoft.Maui.ApplicationArtifacts.Windows", "Microsoft.Maui.Graphics.Windows" ] } @@ -119,6 +120,10 @@ "win-arm64": "Microsoft.Maui.Graphics.Win2D.WinUI.Desktop" } }, + "Microsoft.Maui.ApplicationArtifacts.Windows": { + "kind": "library", + "version": "@VERSION@" + }, "Microsoft.Maui.Resizetizer": { "kind": "library", "version": "@VERSION@" diff --git a/src/Workload/README.md b/src/Workload/README.md index 4b0a6443d949..e86e69a90fc5 100644 --- a/src/Workload/README.md +++ b/src/Workload/README.md @@ -88,6 +88,8 @@ installed: * `maui-macos` * `maui-windows` +The `maui-windows` workload also installs `Microsoft.Maui.ApplicationArtifacts.Windows`, a targets-only package that exposes final modern Windows App SDK build and publish outputs as `@(ApplicationArtifact)`. The package can be referenced directly by non-MAUI Windows App SDK applications; classic `.wapproj` projects are outside its scope. + `maui-android` simply extends the `android` workload, adding the Android-specific platform implementation for MAUI. From 312526123e9b6e3f2d8d4099d7578df6c71de47e Mon Sep 17 00:00:00 2001 From: redth Date: Thu, 26 Nov 2026 16:33:14 -0500 Subject: [PATCH 6/6] Move Windows ApplicationArtifact targets into Microsoft.Maui.Core Remove the separate Microsoft.Maui.ApplicationArtifacts.Windows package and ship the producer in Core's buildTransitive WinUI targets. Trim the item schema to match dotnet/android and dotnet/macios: report only final outputs (output directory for unpackaged apps; msix/bundle/upload/appinstaller files) with PackageFormat, IsDirectory, Signed, EntryPoint, RuntimeIdentifier and the common Application* metadata. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- Microsoft.Maui-dev.sln | 7 - Microsoft.Maui-mac.slnf | 1 - Microsoft.Maui-windows.slnf | 1 - Microsoft.Maui.sln | 7 - docs/design/ApplicationArtifact.md | 41 +- docs/design/NuGets.md | 9 +- eng/Microsoft.Maui.Packages-mac.slnf | 1 - eng/Microsoft.Maui.Packages.slnf | 1 - eng/cake/dotnet.cake | 1 - src/Core/src/Core.csproj | 3 - .../Microsoft.Maui.Core.After.targets | 1 + .../WinUI.ApplicationArtifacts.targets | 279 ++++++++++ .../BaseBuildTest.cs | 1 - ...WindowsApplicationArtifactsTargetsTest.cs} | 331 ++++-------- .../WindowsTemplateTest.cs | 132 +---- ...t.Maui.ApplicationArtifacts.Windows.csproj | 21 - ....Maui.ApplicationArtifacts.Windows.targets | 490 ------------------ .../WorkloadManifest.in.json | 5 - src/Workload/README.md | 2 - 19 files changed, 425 insertions(+), 909 deletions(-) create mode 100644 src/Core/src/nuget/buildTransitive/WinUI.ApplicationArtifacts.targets rename src/TestUtils/src/Microsoft.Maui.IntegrationTests/{WindowsApplicationArtifactsPackageTest.cs => WindowsApplicationArtifactsTargetsTest.cs} (50%) delete mode 100644 src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj delete mode 100644 src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets diff --git a/Microsoft.Maui-dev.sln b/Microsoft.Maui-dev.sln index afbd8b5369bc..5d7ab932aaab 100644 --- a/Microsoft.Maui-dev.sln +++ b/Microsoft.Maui-dev.sln @@ -257,8 +257,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UITest.Analyzers.Tests", "s EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maui25871Library", "src\Controls\tests\Maui25871Library\Maui25871Library.csproj", "{8820D95F-EB6D-4B70-4985-759AAC83CF68}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.ApplicationArtifacts.Windows", "src\Workload\Microsoft.Maui.ApplicationArtifacts.Windows\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "{3BC53DE7-90E7-47FB-9A70-D913782E07D6}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -664,10 +662,6 @@ Global {8820D95F-EB6D-4B70-4985-759AAC83CF68}.Debug|Any CPU.Build.0 = Debug|Any CPU {8820D95F-EB6D-4B70-4985-759AAC83CF68}.Release|Any CPU.ActiveCfg = Release|Any CPU {8820D95F-EB6D-4B70-4985-759AAC83CF68}.Release|Any CPU.Build.0 = Release|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -786,7 +780,6 @@ Global {1A031B27-6EE7-35A8-5C38-EB7370E6029E} = {6A5A18F7-8A4B-639B-2D50-68074424D750} {5E0D0ACD-EA38-448D-B643-30B966A41922} = {1A031B27-6EE7-35A8-5C38-EB7370E6029E} {8820D95F-EB6D-4B70-4985-759AAC83CF68} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} - {3BC53DE7-90E7-47FB-9A70-D913782E07D6} = {EC63FD88-5E12-46D7-B440-68F70241D987} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50} diff --git a/Microsoft.Maui-mac.slnf b/Microsoft.Maui-mac.slnf index c3b4fedcec20..8b3c73639fcc 100644 --- a/Microsoft.Maui-mac.slnf +++ b/Microsoft.Maui-mac.slnf @@ -68,7 +68,6 @@ "src\\TestUtils\\src\\VisualTestUtils\\VisualTestUtils.csproj", "src\\TestUtils\\src\\VisualTestUtils.MagickNet\\VisualTestUtils.MagickNet.csproj", "src\\TestUtils\\src\\Microsoft.Maui.IntegrationTests\\Microsoft.Maui.IntegrationTests.csproj", - "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/Microsoft.Maui-windows.slnf b/Microsoft.Maui-windows.slnf index 79c21e14183f..b5affb7f5992 100644 --- a/Microsoft.Maui-windows.slnf +++ b/Microsoft.Maui-windows.slnf @@ -86,7 +86,6 @@ "src\\TestUtils\\src\\UITest.NUnit\\UITest.NUnit.csproj", "src\\TestUtils\\src\\VisualTestUtils\\VisualTestUtils.csproj", "src\\TestUtils\\src\\VisualTestUtils.MagickNet\\VisualTestUtils.MagickNet.csproj", - "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/Microsoft.Maui.sln b/Microsoft.Maui.sln index f4d872a9d6b4..c556e985bcca 100644 --- a/Microsoft.Maui.sln +++ b/Microsoft.Maui.sln @@ -248,8 +248,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls.ManualTests", "src EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualTestUtils.MagickNet.Tests", "src\TestUtils\tests\VisualTestUtils.MagickNet.Tests\VisualTestUtils.MagickNet.Tests.csproj", "{77D32E05-DF9A-4580-9F0E-E765D74B87EF}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.ApplicationArtifacts.Windows", "src\Workload\Microsoft.Maui.ApplicationArtifacts.Windows\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "{3BC53DE7-90E7-47FB-9A70-D913782E07D6}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -651,10 +649,6 @@ Global {77D32E05-DF9A-4580-9F0E-E765D74B87EF}.Debug|Any CPU.Build.0 = Debug|Any CPU {77D32E05-DF9A-4580-9F0E-E765D74B87EF}.Release|Any CPU.ActiveCfg = Release|Any CPU {77D32E05-DF9A-4580-9F0E-E765D74B87EF}.Release|Any CPU.Build.0 = Release|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3BC53DE7-90E7-47FB-9A70-D913782E07D6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -770,7 +764,6 @@ Global {4ADCBA87-30DB-44F5-85E9-94A4F4132FD9} = {E1082E26-D700-4127-9329-66D673FD2D55} {E2BFD1F1-07A8-8DBE-3661-894D0FE37D9C} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} {77D32E05-DF9A-4580-9F0E-E765D74B87EF} = {6998CAA1-11D4-46B2-B80F-0AC882F58124} - {3BC53DE7-90E7-47FB-9A70-D913782E07D6} = {EC63FD88-5E12-46D7-B440-68F70241D987} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50} diff --git a/docs/design/ApplicationArtifact.md b/docs/design/ApplicationArtifact.md index 62dfdcb5570b..56fea5980d32 100644 --- a/docs/design/ApplicationArtifact.md +++ b/docs/design/ApplicationArtifact.md @@ -4,7 +4,7 @@ - .NET for Android creates APK and AAB items. - .NET for iOS, Mac Catalyst, tvOS, and macOS creates `.app`, `.ipa`, `.pkg`, and `.xcarchive` items. -- `Microsoft.Maui.ApplicationArtifacts.Windows` creates items for modern SDK-style Windows App SDK applications. +- `Microsoft.Maui.Core` creates items for Windows App SDK applications until an equivalent ships in the Windows App SDK itself. - Other platforms should populate the same item group from their own build or publish pipeline. MAUI does not rediscover platform package files and does not create a parallel MAUI-specific artifact item group. Each producer attaches common metadata from its final manifest or resolved build output: @@ -15,28 +15,33 @@ MAUI does not rediscover platform package files and does not create a parallel M - `ApplicationDisplayVersion` - `ApplicationVersion` -Platform-specific metadata remains available alongside the common values, such as Android `PackageId`, Apple `BundleIdentifier`, and Windows `PackageVersion`. `ApplicationIdGuid` is Windows-specific and is present only when the effective package identity is a GUID. Resource-backed names remain resource references when the build cannot resolve a single locale. +Platform-specific metadata remains available alongside the common values, such as Android `PackageId` and Apple `BundleIdentifier`. Every item has an absolute path. Resource-backed names remain resource references when the build cannot resolve a single locale. -Each platform owns `GetApplicationArtifacts`, retains `$(GetApplicationArtifactsDependsOn)` as the downstream extension point, and makes the collected items available during Publish. +## Consuming artifacts + +Each platform defines `GetApplicationArtifacts`, which depends on `Build` and returns `@(ApplicationArtifact)`. Tools should call that target instead of relying on when a particular platform target happens to populate the items: + +```bash +dotnet build -f net11.0-android -t:GetApplicationArtifacts -getItem:ApplicationArtifact +dotnet publish -f net11.0-ios -getItem:ApplicationArtifact +``` + +Targets that add or update metadata should extend `$(GetApplicationArtifactsDependsOn)` and update the platform-created items rather than creating new ones. Publish-path items are available to `AfterTargets="Publish"` consumers in the same invocation. ## Windows App SDK -`Microsoft.Maui.ApplicationArtifacts.Windows` is a targets-only `buildTransitive` package with no MAUI runtime, Resizetizer, or MAUI build-task dependency. `Microsoft.Maui.Core` depends on it only for Windows target frameworks, and non-MAUI Windows App SDK applications can reference it directly. It activates for real, non-design-time Windows App SDK application builds with `Exe` or `WinExe` output. Set `EnableWindowsApplicationArtifacts` to `false` to disable it. Classic `.wapproj` packaging is not supported. +The Windows producer ships in the `buildTransitive` targets of `Microsoft.Maui.Core` and is imported only for Windows target frameworks that use the Windows App SDK. It activates for real, non-design-time application builds with `Exe` or `WinExe` output. Set `EnableWindowsApplicationArtifacts` to `false` to disable it. Classic `.wapproj` packaging is not supported. -The package defines `GetApplicationArtifacts`, retains `$(GetApplicationArtifactsDependsOn)` as the downstream extension point, and makes publish-path items available to `AfterTargets="Publish"` consumers in the same invocation. It reads final Windows App SDK output properties and item lists rather than searching output directories. +It reads final Windows App SDK output properties and item lists rather than searching output directories, and reports only final application outputs: -Each Windows item has an `ArtifactRole`: +| Output | `PackageFormat` | `IsDirectory` | +|---|---|---| +| Unpackaged (`WindowsPackageType=None`) build or publish directory | `directory` | `true` | +| MSIX package (including sparse packages) | `msix` | `false` | +| Bundle | `msixbundle` | `false` | +| Store upload | `msixupload` | `false` | +| App Installer file | `appinstaller` | `false` | -- `Primary` -- `PayloadDirectory` -- `Bundle` -- `StoreUpload` -- `DeploymentManifest` -- `Symbols` -- `Certificate` -- `InstallScript` -- `DependencyPackage` -- `LandingPage` -- `Support` +Legacy `appx`, `appxbundle`, and `appxupload` formats are reported the same way. Intermediate files, dependency framework packages, symbols, certificates, install scripts, and loose upload contents are not application artifacts. -Windows items also provide `IsPrimary`, `PrimaryArtifact`, `PackageFormat`, `PackageType`, `PackageVersion`, `Architecture`, `RuntimeIdentifier`, `Signed`, `BundlePlatforms`, `EntryPoint`, and `DeploymentDirectory` when available. Packaged identity, display name, and version metadata comes from the final Appx manifest, including unchanged `ms-resource:` references. +Windows items also provide `Signed`, `EntryPoint` (the application executable name), `RuntimeIdentifier`, and `PlatformName=Windows`. Packaged identity, display name, and version metadata comes from the final Appx manifest, including unchanged `ms-resource:` references. A four-part package version `a.b.c.d` maps to `ApplicationDisplayVersion=a.b.c` and `ApplicationVersion=d`. diff --git a/docs/design/NuGets.md b/docs/design/NuGets.md index 5cedce9b0c22..edf676bff05a 100644 --- a/docs/design/NuGets.md +++ b/docs/design/NuGets.md @@ -12,7 +12,6 @@ There are several artifacts in the .NET MAUI "universe": * `Microsoft.Maui.Controls.Xaml` - The XAML parser * `Microsoft.Maui.Controls.Build.Tasks` - The real set of XAML[C|G] targets and globs * `Microsoft.Maui.Resizetizer` - The framework-and-platform-agnostic asset generator and integrator - * `Microsoft.Maui.ApplicationArtifacts.Windows` - Targets-only discovery of final Windows App SDK application outputs * `Microsoft.Maui.Core` - The base interfaces and handlers for all .NET MAUI things * `Microsoft.Maui.Essentials` - The core set of framework-agnostic, cross-platform APIs * .NET MAUI maps support: @@ -42,7 +41,6 @@ Most nugets do not contain or need targets and/or props files, but some do. Thes - Manifest - `Microsoft.NET.Sdk.Maui.Manifest` - SDK - `Microsoft.Maui.Sdk` - NuGet Packages - - Windows application artifacts - `Microsoft.Maui.ApplicationArtifacts.Windows` - Controls - `Microsoft.Maui.Controls.Build.Tasks` - Core - `Microsoft.Maui.Core` - Resizetizer - `Microsoft.Maui.Resizetizer` @@ -105,17 +103,12 @@ The targets file can then import all the SDK: ### Targets in the Packs -There are 4 packs today that need targets: +There are 3 packs today that need targets: - - Windows application artifacts - `Microsoft.Maui.ApplicationArtifacts.Windows` - Controls - `Microsoft.Maui.Controls.Build.Tasks` - Core - `Microsoft.Maui.Core` - Resizetizer - `Microsoft.Maui.Resizetizer` -#### Targets in Windows application artifacts - -`Microsoft.Maui.ApplicationArtifacts.Windows` is a neutral, targets-only package. Its `buildTransitive` target discovers final outputs from modern SDK-style Windows App SDK application projects and exposes them as `@(ApplicationArtifact)`. It has no dependency on MAUI runtime assemblies, Resizetizer, or MAUI build tasks, so non-MAUI Windows App SDK applications can reference it directly. Classic `.wapproj` packaging is not supported. - #### Targets in Controls The Controls section of MAUI is the main set of libraries that a MAUI app uses. The targets and props needed but MAUI mostly live in the `Microsoft.Maui.Controls.Build.Tasks` nuget. This is mainly because of the dependency structure of MAUI. diff --git a/eng/Microsoft.Maui.Packages-mac.slnf b/eng/Microsoft.Maui.Packages-mac.slnf index 1562ad5fcb33..0fc5381ff863 100644 --- a/eng/Microsoft.Maui.Packages-mac.slnf +++ b/eng/Microsoft.Maui.Packages-mac.slnf @@ -21,7 +21,6 @@ "src\\Graphics\\src\\Text.Markdig\\Graphics.Text.Markdig.csproj", "src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj", "src\\Templates\\src\\Microsoft.Maui.Templates.csproj", - "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/eng/Microsoft.Maui.Packages.slnf b/eng/Microsoft.Maui.Packages.slnf index 225c00363656..1318306144c1 100644 --- a/eng/Microsoft.Maui.Packages.slnf +++ b/eng/Microsoft.Maui.Packages.slnf @@ -24,7 +24,6 @@ "src\\Essentials\\src\\Essentials.csproj", "src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj", "src\\Templates\\src\\Microsoft.Maui.Templates.csproj", - "src\\Workload\\Microsoft.Maui.ApplicationArtifacts.Windows\\Microsoft.Maui.ApplicationArtifacts.Windows.csproj", "src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj", "src\\Workload\\Microsoft.NET.Sdk.Maui.Manifest\\Microsoft.NET.Sdk.Maui.Manifest.csproj" ] diff --git a/eng/cake/dotnet.cake b/eng/cake/dotnet.cake index b8eb4302c22c..c4f2f5d1c440 100644 --- a/eng/cake/dotnet.cake +++ b/eng/cake/dotnet.cake @@ -34,7 +34,6 @@ var NuGetOnlyPackages = new string[] { "Microsoft.Maui.Core.*.{nupkg,snupkg}", "Microsoft.Maui.Essentials.*.{nupkg,snupkg}", "Microsoft.Maui.Graphics.*.{nupkg,snupkg}", - "Microsoft.Maui.ApplicationArtifacts.Windows.*.{nupkg,snupkg}", "Microsoft.Maui.Maps.*.{nupkg,snupkg}", "Microsoft.Maui.Resizetizer.*.{nupkg,snupkg}", "Microsoft.AspNetCore.Components.WebView.*.{nupkg,snupkg}", diff --git a/src/Core/src/Core.csproj b/src/Core/src/Core.csproj index 17cc628ea20f..c96fa7b0f704 100644 --- a/src/Core/src/Core.csproj +++ b/src/Core/src/Core.csproj @@ -53,9 +53,6 @@ - diff --git a/src/Core/src/nuget/buildTransitive/Microsoft.Maui.Core.After.targets b/src/Core/src/nuget/buildTransitive/Microsoft.Maui.Core.After.targets index e4fc59f192b4..b347e9a31d43 100644 --- a/src/Core/src/nuget/buildTransitive/Microsoft.Maui.Core.After.targets +++ b/src/Core/src/nuget/buildTransitive/Microsoft.Maui.Core.After.targets @@ -35,5 +35,6 @@ This results in the $(TargetPlatformIdentifier) condition being met - even though there are no WASK targets to run! --> + \ No newline at end of file diff --git a/src/Core/src/nuget/buildTransitive/WinUI.ApplicationArtifacts.targets b/src/Core/src/nuget/buildTransitive/WinUI.ApplicationArtifacts.targets new file mode 100644 index 000000000000..84f1005c6b9d --- /dev/null +++ b/src/Core/src/nuget/buildTransitive/WinUI.ApplicationArtifacts.targets @@ -0,0 +1,279 @@ + + + + + <_MauiWindowsApplicationArtifactsEnabled + Condition="'$(EnableWindowsApplicationArtifacts)' != 'false' + and '$(MicrosoftWindowsAppSDKPackageDir)' != '' + and '$(MSBuildProjectExtension)' != '.wapproj' + and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' + and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true + + + _CollectMauiWindowsApplicationArtifacts; + $(GetApplicationArtifactsDependsOn) + + + + + + + + + + + + + + <_MauiWindowsArtifactsCollectingForPublish>true + + + + + + + + + + + <_MauiWindowsArtifactUnpackagedDirectory>$([System.IO.Path]::GetDirectoryName($([MSBuild]::EnsureTrailingSlash($([System.IO.Path]::GetFullPath('$(PublishDir)')))))) + + + + <_MauiWindowsArtifactPrevious Include="@(ApplicationArtifact)" + Condition="'%(ApplicationArtifact._MauiWindowsApplicationArtifact)' == 'true'" /> + + + directory + true + false + $(_MauiWindowsArtifactEntryPoint) + $(RuntimeIdentifier) + Windows + $(_MauiWindowsArtifactApplicationId) + $(_MauiWindowsArtifactApplicationTitle) + $(_MauiWindowsArtifactApplicationName) + $(_MauiWindowsArtifactApplicationDisplayVersion) + $(_MauiWindowsArtifactApplicationVersion) + <_MauiWindowsApplicationArtifact>true + + <_MauiWindowsArtifactPrevious Remove="@(_MauiWindowsArtifactPrevious)" /> + + + + + + + <_MauiWindowsArtifactPrevious Include="@(ApplicationArtifact)" + Condition="'%(ApplicationArtifact._MauiWindowsApplicationArtifact)' == 'true'" /> + + <_MauiWindowsArtifactPrevious Remove="@(_MauiWindowsArtifactPrevious)" /> + <_MauiWindowsArtifactRaw Remove="@(_MauiWindowsArtifactRaw)" /> + <_MauiWindowsArtifactReportedOutput Remove="@(_MauiWindowsArtifactReportedOutput)" /> + <_MauiWindowsArtifactNormalized Remove="@(_MauiWindowsArtifactNormalized)" /> + <_MauiWindowsArtifactDistinct Remove="@(_MauiWindowsArtifactDistinct)" /> + + + + + + + + + + + + + + + + + + <_MauiWindowsArtifactPackageVersion Condition="'$(WindowsPackageType)' != 'None'">$([MSBuild]::ValueOrDefault('$(_MauiWindowsArtifactManifestVersion)', '$(AppxManifestIdentityVersion)')) + + <_MauiWindowsArtifactApplicationId Condition="'$(WindowsPackageType)' != 'None' and '$(_MauiWindowsArtifactManifestIdentity)' != ''">$(_MauiWindowsArtifactManifestIdentity) + <_MauiWindowsArtifactApplicationId Condition="'$(WindowsPackageType)' != 'None' and '$(_MauiWindowsArtifactApplicationId)' == '' and '$(AppxManifestIdentityName)' != ''">$(AppxManifestIdentityName) + <_MauiWindowsArtifactApplicationId Condition="'$(_MauiWindowsArtifactApplicationId)' == '' and '$(ApplicationId)' != ''">$(ApplicationId) + <_MauiWindowsArtifactApplicationId Condition="'$(_MauiWindowsArtifactApplicationId)' == ''">$(AssemblyName) + + <_MauiWindowsArtifactApplicationTitle Condition="'$(WindowsPackageType)' != 'None' and '$(_MauiWindowsArtifactManifestDisplayName)' != ''">$(_MauiWindowsArtifactManifestDisplayName) + <_MauiWindowsArtifactApplicationTitle Condition="'$(_MauiWindowsArtifactApplicationTitle)' == '' and '$(ApplicationTitle)' != ''">$(ApplicationTitle) + <_MauiWindowsArtifactApplicationTitle Condition="'$(_MauiWindowsArtifactApplicationTitle)' == '' and '$(ApplicationName)' != ''">$(ApplicationName) + <_MauiWindowsArtifactApplicationTitle Condition="'$(_MauiWindowsArtifactApplicationTitle)' == '' and '$(AssemblyTitle)' != ''">$(AssemblyTitle) + <_MauiWindowsArtifactApplicationTitle Condition="'$(_MauiWindowsArtifactApplicationTitle)' == ''">$(AssemblyName) + + <_MauiWindowsArtifactApplicationName Condition="'$(WindowsPackageType)' != 'None' and '$(_MauiWindowsArtifactManifestDisplayName)' != ''">$(_MauiWindowsArtifactManifestDisplayName) + <_MauiWindowsArtifactApplicationName Condition="'$(_MauiWindowsArtifactApplicationName)' == '' and '$(ApplicationName)' != ''">$(ApplicationName) + <_MauiWindowsArtifactApplicationName Condition="'$(_MauiWindowsArtifactApplicationName)' == '' and '$(ApplicationTitle)' != ''">$(ApplicationTitle) + <_MauiWindowsArtifactApplicationName Condition="'$(_MauiWindowsArtifactApplicationName)' == ''">$(AssemblyName) + + + <_MauiWindowsArtifactApplicationDisplayVersion + Condition="'$(WindowsPackageType)' != 'None' + and $([System.Text.RegularExpressions.Regex]::IsMatch('$(_MauiWindowsArtifactPackageVersion)', '^\d+\.\d+\.\d+\.\d+$'))">$([System.Text.RegularExpressions.Regex]::Replace('$(_MauiWindowsArtifactPackageVersion)', '^(\d+\.\d+\.\d+)\.(\d+)$', '$1')) + <_MauiWindowsArtifactApplicationVersion + Condition="'$(WindowsPackageType)' != 'None' + and $([System.Text.RegularExpressions.Regex]::IsMatch('$(_MauiWindowsArtifactPackageVersion)', '^\d+\.\d+\.\d+\.\d+$'))">$([System.Text.RegularExpressions.Regex]::Replace('$(_MauiWindowsArtifactPackageVersion)', '^(\d+\.\d+\.\d+)\.(\d+)$', '$2')) + <_MauiWindowsArtifactApplicationDisplayVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MauiWindowsArtifactApplicationDisplayVersion)' == ''">$(_MauiWindowsArtifactPackageVersion) + <_MauiWindowsArtifactApplicationVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MauiWindowsArtifactApplicationVersion)' == ''">$(ApplicationVersion) + + <_MauiWindowsArtifactApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(ApplicationDisplayVersion)' != ''">$(ApplicationDisplayVersion) + <_MauiWindowsArtifactApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MauiWindowsArtifactApplicationDisplayVersion)' == '' and '$(InformationalVersion)' != ''">$(InformationalVersion) + <_MauiWindowsArtifactApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MauiWindowsArtifactApplicationDisplayVersion)' == ''">$(Version) + <_MauiWindowsArtifactApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(ApplicationVersion)' != ''">$(ApplicationVersion) + <_MauiWindowsArtifactApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MauiWindowsArtifactApplicationVersion)' == '' and '$(FileVersion)' != ''">$(FileVersion) + <_MauiWindowsArtifactApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MauiWindowsArtifactApplicationVersion)' == ''">$(AssemblyVersion) + + <_MauiWindowsArtifactSigned Condition="'$(WindowsPackageType)' != 'None' and '$(AppxPackageSigningEnabled)' == 'true'">true + <_MauiWindowsArtifactSigned Condition="'$(_MauiWindowsArtifactSigned)' == ''">false + + <_MauiWindowsArtifactEntryPoint Condition="'$(WindowsPackageType)' != 'None'">$(_MauiWindowsArtifactManifestExecutable) + <_MauiWindowsArtifactEntryPoint Condition="'$(WindowsPackageType)' == 'None'">$(TargetName).exe + + + + + <_MauiWindowsArtifactUnpackagedDirectory Condition="'$(_MauiWindowsArtifactsCollectingForPublish)' == 'true' and '$(PublishDir)' != '' and Exists('$(PublishDir)')">$(PublishDir) + <_MauiWindowsArtifactUnpackagedDirectory Condition="'$(_MauiWindowsArtifactUnpackagedDirectory)' == '' and '$(TargetDir)' != '' and Exists('$(TargetDir)')">$(TargetDir) + <_MauiWindowsArtifactUnpackagedDirectory Condition="'$(_MauiWindowsArtifactUnpackagedDirectory)' != ''">$([System.IO.Path]::GetDirectoryName($([MSBuild]::EnsureTrailingSlash($([System.IO.Path]::GetFullPath('$(_MauiWindowsArtifactUnpackagedDirectory)')))))) + + + + <_MauiWindowsArtifactRaw Include="$(_MauiWindowsArtifactUnpackagedDirectory)" + PackageFormat="directory" + IsDirectory="true" /> + + + + + <_MauiWindowsArtifactRaw Include="$(AppxPackageOutput)" Condition="'$(AppxPackageOutput)' != '' and Exists('$(AppxPackageOutput)')" /> + <_MauiWindowsArtifactRaw Include="$(AppxMainPackageOutput)" Condition="'$(AppxMainPackageOutput)' != '' and Exists('$(AppxMainPackageOutput)')" /> + <_MauiWindowsArtifactRaw Include="@(FinalAppxPackageItem)" Condition="Exists('%(FinalAppxPackageItem.Identity)')" /> + <_MauiWindowsArtifactRaw Include="$(AppxBundleOutput)" Condition="'$(AppxBundleOutput)' != '' and Exists('$(AppxBundleOutput)')" /> + <_MauiWindowsArtifactRaw Include="$(AppxStoreContainer)" Condition="'$(AppxStoreContainer)' != '' and Exists('$(AppxStoreContainer)')" /> + <_MauiWindowsArtifactRaw Include="@(AppInstallerFilePath)" Condition="Exists('%(AppInstallerFilePath.Identity)')" /> + + + + <_MauiWindowsArtifactReportedOutput Include="@(InstallerFileWrites);@(PackagingFileWrites);@(AllBuiltSideloadPackages);@(AppInstallerFileWrites)" /> + <_MauiWindowsArtifactReportedOutput Update="@(_MauiWindowsArtifactReportedOutput)"> + <_Comparable>$([System.String]::Copy('%(FullPath)').ToLowerInvariant()) + <_ExtensionLower>$([System.String]::Copy('%(Extension)').ToLowerInvariant()) + + + + + <_MauiWindowsArtifactIntermediateDirComparable Condition="'$(IntermediateOutputPath)' != ''">$([MSBuild]::EnsureTrailingSlash($([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)'))).ToLowerInvariant()) + <_MauiWindowsArtifactUploadDirComparable Condition="'$(AppxUploadPackageDir)' != ''">$([MSBuild]::EnsureTrailingSlash($([System.IO.Path]::GetFullPath('$(AppxUploadPackageDir)'))).ToLowerInvariant()) + + + + + <_MauiWindowsArtifactReportedOutput Update="@(_MauiWindowsArtifactReportedOutput)"> + <_IsFinal>false + <_IsFinal Condition="'%(_ExtensionLower)' == '.msix' or '%(_ExtensionLower)' == '.appx' + or '%(_ExtensionLower)' == '.msixbundle' or '%(_ExtensionLower)' == '.appxbundle' + or '%(_ExtensionLower)' == '.msixupload' or '%(_ExtensionLower)' == '.appxupload' + or '%(_ExtensionLower)' == '.appinstaller'">true + + <_MauiWindowsArtifactReportedOutput Update="@(_MauiWindowsArtifactReportedOutput)" + Condition="'%(_IsFinal)' == 'true' + and ((('$(_MauiWindowsArtifactIntermediateDirComparable)' != '' and $([System.String]::Copy('%(_Comparable)').StartsWith('$(_MauiWindowsArtifactIntermediateDirComparable)'))) + or ('$(_MauiWindowsArtifactUploadDirComparable)' != '' and $([System.String]::Copy('%(_Comparable)').StartsWith('$(_MauiWindowsArtifactUploadDirComparable)'))) + or $([System.String]::Copy('%(_Comparable)').Contains('\dependencies\')) + or $([System.String]::Copy('%(_Comparable)').Contains('/dependencies/'))))"> + <_IsFinal>false + + + <_MauiWindowsArtifactRaw Include="@(_MauiWindowsArtifactReportedOutput)" + Condition="'%(_MauiWindowsArtifactReportedOutput._IsFinal)' == 'true' and Exists('%(_MauiWindowsArtifactReportedOutput.Identity)')" /> + + <_MauiWindowsArtifactRaw Update="@(_MauiWindowsArtifactRaw)"> + $([System.String]::Copy('%(Extension)').TrimStart('.').ToLowerInvariant()) + false + + + + + <_MauiWindowsArtifactNormalized Include="@(_MauiWindowsArtifactRaw->'%(FullPath)')" KeepMetadata="PackageFormat;IsDirectory" /> + + + + + + + + + %(_MauiWindowsArtifactDistinct.PackageFormat) + %(_MauiWindowsArtifactDistinct.IsDirectory) + $(_MauiWindowsArtifactSigned) + $(_MauiWindowsArtifactEntryPoint) + $(RuntimeIdentifier) + Windows + $(_MauiWindowsArtifactApplicationId) + $(_MauiWindowsArtifactApplicationTitle) + $(_MauiWindowsArtifactApplicationName) + $(_MauiWindowsArtifactApplicationDisplayVersion) + $(_MauiWindowsArtifactApplicationVersion) + <_MauiWindowsApplicationArtifact>true + + + + + diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs index f0e0ae3a578d..56dc30dbf7d0 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/BaseBuildTest.cs @@ -44,7 +44,6 @@ private void SetUpNuGetPackages() "Microsoft.Maui.Core.*.nupkg", "Microsoft.Maui.Essentials.*.nupkg", "Microsoft.Maui.Graphics.*.nupkg", - "Microsoft.Maui.ApplicationArtifacts.Windows.*.nupkg", "Microsoft.Maui.Maps.*.nupkg", "Microsoft.Maui.Resizetizer.*.nupkg", "Microsoft.AspNetCore.Components.WebView.*.nupkg", diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsPackageTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsTargetsTest.cs similarity index 50% rename from src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsPackageTest.cs rename to src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsTargetsTest.cs index a1e5a6f6918e..53df62fe1cb9 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsPackageTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsApplicationArtifactsTargetsTest.cs @@ -1,91 +1,31 @@ -using System.IO.Compression; using System.Security; -using System.Xml.Linq; namespace Microsoft.Maui.IntegrationTests; [Trait("Category", "Build")] -public class WindowsApplicationArtifactsPackageTest : BaseBuildTest +public class WindowsApplicationArtifactsTargetsTest : BaseBuildTest { - const string PackageId = "Microsoft.Maui.ApplicationArtifacts.Windows"; - - public WindowsApplicationArtifactsPackageTest(IntegrationTestFixture fixture, ITestOutputHelper output) + public WindowsApplicationArtifactsTargetsTest(IntegrationTestFixture fixture, ITestOutputHelper output) : base(fixture, output) { } - [Fact] - public void PackageContainsOnlyNeutralBuildAssets() - { - SetTestIdentifier(nameof(PackageContainsOnlyNeutralBuildAssets)); - var packagePath = FindPackage(PackageId); - - using var archive = ZipFile.OpenRead(packagePath); - var entries = archive.Entries.Select(entry => entry.FullName).ToArray(); - - Assert.Contains("buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets", entries); - Assert.DoesNotContain(entries, entry => - entry.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || - entry.StartsWith("lib/", StringComparison.OrdinalIgnoreCase) || - entry.StartsWith("runtimes/", StringComparison.OrdinalIgnoreCase) || - entry.StartsWith("tools/", StringComparison.OrdinalIgnoreCase) || - entry.StartsWith("analyzers/", StringComparison.OrdinalIgnoreCase)); - Assert.Single(entries.Where(entry => entry.StartsWith("buildTransitive/", StringComparison.OrdinalIgnoreCase))); - - var nuspecEntry = Assert.Single(archive.Entries.Where(entry => entry.FullName.EndsWith(".nuspec", StringComparison.OrdinalIgnoreCase))); - using var nuspecStream = nuspecEntry.Open(); - var nuspec = XDocument.Load(nuspecStream); - var ns = nuspec.Root!.Name.Namespace; - var packageType = Assert.Single(nuspec.Descendants(ns + "packageType")); - Assert.Equal("Dependency", (string?)packageType.Attribute("name")); - } + static string TargetsFile => Path.Combine( + TestEnvironment.GetMauiDirectory(), + "src", + "Core", + "src", + "nuget", + "buildTransitive", + "WinUI.ApplicationArtifacts.targets"); - [Fact] - public void CorePackageDependsOnApplicationArtifactsOnlyForWindows() - { - SetTestIdentifier(nameof(CorePackageDependsOnApplicationArtifactsOnlyForWindows)); - if (!TestEnvironment.IsWindows) - { - if (true) - return; // Skip: "Packing the Windows Core target framework is only supported on Windows CI." - } - - var coreProject = Path.Combine(TestEnvironment.GetMauiDirectory(), "src", "Core", "src", "Core.csproj"); - Assert.True( - DotnetInternal.Run( - "pack", - $"\"{coreProject}\" -c Debug --no-build --no-restore -p:Packing=true -p:EnableWindowsTargeting=true -p:IncludeBuildOutput=false -p:NoWarn=NU5127%3BNU5128 -p:PackageOutputPath=\"{TestDirectory}\" -v:minimal", - output: _output), - "Unable to generate the Core package dependency graph."); - var packagePath = Path.Combine(TestDirectory, $"Microsoft.Maui.Core.{MauiPackageVersion}.nupkg"); - Assert.True(File.Exists(packagePath), $"The expected Core package was not created at '{packagePath}'."); - - using var archive = ZipFile.OpenRead(packagePath); - var nuspecEntry = Assert.Single(archive.Entries.Where(entry => entry.FullName.EndsWith(".nuspec", StringComparison.OrdinalIgnoreCase))); - using var nuspecStream = nuspecEntry.Open(); - var nuspec = XDocument.Load(nuspecStream); - var ns = nuspec.Root!.Name.Namespace; - var dependencyGroups = nuspec - .Descendants(ns + "group") - .Where(group => group.Elements(ns + "dependency").Any(dependency => - string.Equals((string?)dependency.Attribute("id"), PackageId, StringComparison.Ordinal))) - .ToArray(); - - Assert.NotEmpty(dependencyGroups); - Assert.All(dependencyGroups, group => - { - Assert.Contains("windows", (string?)group.Attribute("targetFramework") ?? string.Empty, StringComparison.OrdinalIgnoreCase); - var dependency = Assert.Single(group.Elements(ns + "dependency").Where(candidate => - string.Equals((string?)candidate.Attribute("id"), PackageId, StringComparison.Ordinal))); - Assert.Equal("All", (string?)dependency.Attribute("include"), ignoreCase: true); - Assert.Null(dependency.Attribute("exclude")); - }); - } + const string ArtifactFormat = + "%(FullPath)|%(PackageFormat)|%(IsDirectory)|%(Signed)|%(EntryPoint)|%(RuntimeIdentifier)|%(PlatformName)|%(ApplicationId)|%(ApplicationTitle)|%(ApplicationName)|%(ApplicationDisplayVersion)|%(ApplicationVersion)|%(Extended)"; [Fact] - public void TargetsClassifyAndDeduplicateAuthoritativeOutputs() + public void PackagedBuildReportsOnlyFinalPackages() { - SetTestIdentifier(nameof(TargetsClassifyAndDeduplicateAuthoritativeOutputs)); + SetTestIdentifier(nameof(PackagedBuildReportsOnlyFinalPackages)); var packageDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "AppPackages")).FullName; var packageTestDir = Directory.CreateDirectory(Path.Combine(packageDir, "ArtifactApp_2.3.4.5_x64_Test")).FullName; var targetDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "bin", "Debug", "net11.0-windows")).FullName; @@ -101,11 +41,8 @@ public void TargetsClassifyAndDeduplicateAuthoritativeOutputs() var certificate = CreateFile(packageTestDir, "ArtifactApp.cer"); var installScript = CreateFile(packageTestDir, "Install.ps1"); var dependency = CreateFile(Path.Combine(packageTestDir, "Dependencies", "x64"), "Framework.msix"); - var landingPage = CreateFile(packageDir, "index.html"); var support = CreateFile(packageDir, "install.json"); - var appInstallerSupport = CreateFile(packageDir, "appinstaller-data.xml"); var intermediate = CreateFile(intermediateDir, "intermediate.msix"); - _ = CreateFile(targetDir, "loose-payload.dll"); var manifest = Path.Combine(targetDir, "AppxManifest.xml"); File.WriteAllText(manifest, """ @@ -113,7 +50,7 @@ public void TargetsClassifyAndDeduplicateAuthoritativeOutputs() - ms-resource:ArtifactApp + ArtifactApp @@ -122,14 +59,7 @@ public void TargetsClassifyAndDeduplicateAuthoritativeOutputs() """); var artifactsFile = Path.Combine(TestDirectory, "application-artifacts.txt"); - var projectFile = Path.Combine(TestDirectory, "ArtifactClassification.proj"); - var targetsFile = Path.Combine( - TestEnvironment.GetMauiDirectory(), - "src", - "Workload", - PackageId, - "buildTransitive", - $"{PackageId}.targets"); + var projectFile = Path.Combine(TestDirectory, "Packaged.proj"); File.WriteAllText(projectFile, $""" @@ -149,16 +79,11 @@ public void TargetsClassifyAndDeduplicateAuthoritativeOutputs() {Escape(bundle)} {Escape(uploadPackage)} {Escape(storeUpload)} - {Escape(symbols)} - {Escape(certificate)} - {Escape(landingPage)} {Escape(manifest)} - x64 win-x64 true - x64_arm64 ArtifactApp - StampCollectedArtifacts + ExtendCollectedArtifacts @@ -167,92 +92,56 @@ public void TargetsClassifyAndDeduplicateAuthoritativeOutputs() - - + + - - - - + + - - extended-%(ApplicationArtifact.BundlePlatforms) - + - + """); Assert.True( DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteApplicationArtifacts -v:minimal", output: _output), - "Unable to execute the Windows ApplicationArtifact targets contract fixture."); - - var artifacts = File.ReadAllLines(artifactsFile) - .Select(ArtifactRecord.Parse) - .ToArray(); - - Assert.Equal(13, artifacts.Length); - Assert.Equal(artifacts.Length, artifacts.Select(artifact => artifact.Path).Distinct(StringComparer.OrdinalIgnoreCase).Count()); - Assert.DoesNotContain(artifacts, artifact => artifact.Path.StartsWith(intermediateDir, StringComparison.OrdinalIgnoreCase)); - Assert.DoesNotContain(artifacts, artifact => artifact.Path.EndsWith("loose-payload.dll", StringComparison.OrdinalIgnoreCase)); - - AssertRole(primary, "Primary", isPrimary: true); - AssertRole(packageTestDir, "PayloadDirectory"); - AssertRole(bundle, "Bundle"); - AssertRole(uploadPackage, "StoreUpload"); - AssertRole(storeUpload, "StoreUpload"); - AssertRole(appInstaller, "DeploymentManifest"); - AssertRole(symbols, "Symbols"); - AssertRole(certificate, "Certificate"); - AssertRole(installScript, "InstallScript"); - AssertRole(dependency, "DependencyPackage"); - AssertRole(landingPage, "LandingPage"); - AssertRole(support, "Support"); - AssertRole(appInstallerSupport, "Support"); + "Unable to execute the packaged Windows ApplicationArtifact fixture."); + + var artifacts = File.ReadAllLines(artifactsFile).Select(ArtifactRecord.Parse).ToArray(); + + Assert.Equal(4, artifacts.Length); + AssertFormat(primary, "msix"); + AssertFormat(bundle, "msixbundle"); + AssertFormat(storeUpload, "msixupload"); + AssertFormat(appInstaller, "appinstaller"); Assert.All(artifacts, artifact => { - Assert.Equal("MSIX", artifact.PackageType); - Assert.Equal("2.3.4.5", artifact.PackageVersion); - Assert.Equal("x64", artifact.Architecture); - Assert.Equal("win-x64", artifact.RuntimeIdentifier); + Assert.Equal("false", artifact.IsDirectory, ignoreCase: true); Assert.Equal("true", artifact.Signed, ignoreCase: true); - Assert.Equal("extended-x64_arm64", artifact.BundlePlatforms); Assert.Equal("ArtifactApp.exe", artifact.EntryPoint); - Assert.Equal( - Path.TrimEndingDirectorySeparator(Path.GetFullPath(packageTestDir)), - Path.TrimEndingDirectorySeparator(Path.GetFullPath(artifact.DeploymentDirectory))); + Assert.Equal("win-x64", artifact.RuntimeIdentifier); + Assert.Equal("Windows", artifact.PlatformName); Assert.Equal("11111111-2222-3333-4444-555555555555", artifact.ApplicationId); - Assert.Equal(artifact.ApplicationId, artifact.ApplicationIdGuid); - Assert.Equal("ms-resource:ArtifactApp", artifact.ApplicationTitle); - Assert.Equal(artifact.ApplicationTitle, artifact.ApplicationName); + Assert.Equal("ArtifactApp", artifact.ApplicationTitle); + Assert.Equal("ArtifactApp", artifact.ApplicationName); Assert.Equal("2.3.4", artifact.ApplicationDisplayVersion); Assert.Equal("5", artifact.ApplicationVersion); + Assert.Equal("true", artifact.Extended); }); - void AssertRole(string path, string role, bool isPrimary = false) + void AssertFormat(string path, string format) { - var artifact = Assert.Single(artifacts.Where(candidate => - string.Equals( - Path.TrimEndingDirectorySeparator(Path.GetFullPath(candidate.Path)), - Path.TrimEndingDirectorySeparator(Path.GetFullPath(path)), - StringComparison.OrdinalIgnoreCase))); - Assert.Equal(role, artifact.Role); - Assert.Equal(isPrimary ? "true" : "false", artifact.IsPrimary, ignoreCase: true); - Assert.Equal( - Path.GetFullPath(isPrimary ? path : primary), - Path.GetFullPath(artifact.PrimaryArtifact), - ignoreCase: true); + var artifact = Assert.Single(artifacts, candidate => SamePath(candidate.Path, path)); + Assert.Equal(format, artifact.PackageFormat); } } @@ -274,13 +163,6 @@ public void TargetsAreInertOutsideRealWindowsAppSdkApplications( SetTestIdentifier(targetFramework, outputType, hasWindowsAppSdk, enabled, designTimeBuild, buildingProject); var artifactsFile = Path.Combine(TestDirectory, "application-artifacts.txt"); var projectFile = Path.Combine(TestDirectory, "Inert.proj"); - var targetsFile = Path.Combine( - TestEnvironment.GetMauiDirectory(), - "src", - "Workload", - PackageId, - "buildTransitive", - $"{PackageId}.targets"); File.WriteAllText(projectFile, $""" @@ -292,9 +174,10 @@ public void TargetsAreInertOutsideRealWindowsAppSdkApplications( {enabled} {(hasWindowsAppSdk ? Escape(TestDirectory) : string.Empty)} None + {Escape(WithDirectorySeparator(TestDirectory))} - + @@ -308,20 +191,13 @@ public void TargetsAreInertOutsideRealWindowsAppSdkApplications( } [Fact] - public void SparsePackageUsesTheFinalMsixAsPrimaryArtifact() + public void SparsePackageReportsTheFinalMsix() { - SetTestIdentifier(nameof(SparsePackageUsesTheFinalMsixAsPrimaryArtifact)); + SetTestIdentifier(nameof(SparsePackageReportsTheFinalMsix)); var targetDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "bin")).FullName; var sparsePackage = CreateFile(targetDir, "SparseApp.msix"); var artifactsFile = Path.Combine(TestDirectory, "application-artifacts.txt"); var projectFile = Path.Combine(TestDirectory, "Sparse.proj"); - var targetsFile = Path.Combine( - TestEnvironment.GetMauiDirectory(), - "src", - "Workload", - PackageId, - "buildTransitive", - $"{PackageId}.targets"); File.WriteAllText(projectFile, $""" @@ -342,9 +218,9 @@ public void SparsePackageUsesTheFinalMsixAsPrimaryArtifact() - + - + """); @@ -353,31 +229,25 @@ public void SparsePackageUsesTheFinalMsixAsPrimaryArtifact() DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteApplicationArtifacts -v:minimal", output: _output), "Unable to execute the sparse Windows ApplicationArtifact fixture."); - var fields = Assert.Single(File.ReadAllLines(artifactsFile)).Split('|'); - Assert.Equal(Path.GetFullPath(sparsePackage), Path.GetFullPath(fields[0]), ignoreCase: true); - Assert.Equal("Primary", fields[1]); - Assert.Equal("Sparse", fields[2]); - Assert.Equal("msix", fields[3]); + var artifact = ArtifactRecord.Parse(Assert.Single(File.ReadAllLines(artifactsFile))); + Assert.True(SamePath(sparsePackage, artifact.Path)); + Assert.Equal("msix", artifact.PackageFormat); + Assert.Equal("false", artifact.IsDirectory, ignoreCase: true); + Assert.Equal("false", artifact.Signed, ignoreCase: true); + Assert.Equal("Windows", artifact.PlatformName); } [Fact] - public void UnpackagedBuildAndPublishUseTheirOwnOutputPaths() + public void UnpackagedBuildAndPublishReportTheirOutputDirectory() { - SetTestIdentifier(nameof(UnpackagedBuildAndPublishUseTheirOwnOutputPaths)); + SetTestIdentifier(nameof(UnpackagedBuildAndPublishReportTheirOutputDirectory)); var targetDir = Directory.CreateDirectory(Path.Combine(TestDirectory, "bin")).FullName; var publishDir = Directory.CreateDirectory(Path.Combine(targetDir, "publish")).FullName; - var buildExecutable = CreateFile(targetDir, "UnpackagedApp.exe"); - var publishExecutable = CreateFile(publishDir, "UnpackagedApp.exe"); + _ = CreateFile(targetDir, "UnpackagedApp.exe"); + _ = CreateFile(publishDir, "UnpackagedApp.exe"); var buildArtifactsFile = Path.Combine(TestDirectory, "build-application-artifacts.txt"); var publishArtifactsFile = Path.Combine(TestDirectory, "publish-application-artifacts.txt"); var projectFile = Path.Combine(TestDirectory, "Unpackaged.proj"); - var targetsFile = Path.Combine( - TestEnvironment.GetMauiDirectory(), - "src", - "Workload", - PackageId, - "buildTransitive", - $"{PackageId}.targets"); File.WriteAllText(projectFile, $""" @@ -391,6 +261,7 @@ public void UnpackagedBuildAndPublishUseTheirOwnOutputPaths() {Escape(WithDirectorySeparator(publishDir))} UnpackagedApp UnpackagedApp + win-arm64 com.example.unpackaged Unpackaged App 1.2.3 @@ -398,13 +269,13 @@ public void UnpackagedBuildAndPublishUseTheirOwnOutputPaths() - + - + - + """); @@ -412,8 +283,7 @@ public void UnpackagedBuildAndPublishUseTheirOwnOutputPaths() Assert.True( DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteBuildApplicationArtifacts;Publish -v:minimal", output: _output), "Unable to collect unpackaged build and publish artifacts in one MSBuild invocation."); - var sameInvocationPublishPrimary = Assert.Single(File.ReadAllLines(publishArtifactsFile).Where(line => line.EndsWith("|Primary", StringComparison.Ordinal))); - Assert.Equal(Path.GetFullPath(publishExecutable), Path.GetFullPath(sameInvocationPublishPrimary.Split('|')[0]), ignoreCase: true); + AssertDirectoryArtifact(publishArtifactsFile, publishDir); File.Delete(buildArtifactsFile); File.Delete(publishArtifactsFile); @@ -421,27 +291,36 @@ public void UnpackagedBuildAndPublishUseTheirOwnOutputPaths() Assert.True( DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:WriteBuildApplicationArtifacts -v:minimal", output: _output), "Unable to collect unpackaged build artifacts."); - var buildPrimary = Assert.Single(File.ReadAllLines(buildArtifactsFile).Where(line => line.EndsWith("|Primary", StringComparison.Ordinal))); - Assert.Equal(Path.GetFullPath(buildExecutable), Path.GetFullPath(buildPrimary.Split('|')[0]), ignoreCase: true); + AssertDirectoryArtifact(buildArtifactsFile, targetDir); Assert.True( DotnetInternal.Run("msbuild", $"\"{projectFile}\" -t:Publish -v:minimal", output: _output), "Unable to collect unpackaged publish artifacts."); - var publishPrimary = Assert.Single(File.ReadAllLines(publishArtifactsFile).Where(line => line.EndsWith("|Primary", StringComparison.Ordinal))); - Assert.Equal(Path.GetFullPath(publishExecutable), Path.GetFullPath(publishPrimary.Split('|')[0]), ignoreCase: true); - } - - string FindPackage(string packageId) - { - var artifactDir = Path.Combine(TestEnvironment.GetMauiDirectory(), "artifacts"); - var matchingPackages = Directory - .GetFiles(artifactDir, $"{packageId}.{MauiPackageVersion}.nupkg", SearchOption.AllDirectories) - .Where(path => !path.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}", StringComparison.OrdinalIgnoreCase)) - .ToArray(); + AssertDirectoryArtifact(publishArtifactsFile, publishDir); - return Assert.Single(matchingPackages); + static void AssertDirectoryArtifact(string artifactsFile, string expectedDirectory) + { + var artifact = ArtifactRecord.Parse(Assert.Single(File.ReadAllLines(artifactsFile))); + Assert.True(SamePath(expectedDirectory, artifact.Path), $"Expected '{expectedDirectory}' but got '{artifact.Path}'."); + Assert.Equal("directory", artifact.PackageFormat); + Assert.Equal("true", artifact.IsDirectory, ignoreCase: true); + Assert.Equal("false", artifact.Signed, ignoreCase: true); + Assert.Equal("UnpackagedApp.exe", artifact.EntryPoint); + Assert.Equal("win-arm64", artifact.RuntimeIdentifier); + Assert.Equal("Windows", artifact.PlatformName); + Assert.Equal("com.example.unpackaged", artifact.ApplicationId); + Assert.Equal("Unpackaged App", artifact.ApplicationTitle); + Assert.Equal("1.2.3", artifact.ApplicationDisplayVersion); + Assert.Equal("4", artifact.ApplicationVersion); + } } + static bool SamePath(string left, string right) => + string.Equals( + Path.TrimEndingDirectorySeparator(Path.GetFullPath(left)), + Path.TrimEndingDirectorySeparator(Path.GetFullPath(right)), + StringComparison.OrdinalIgnoreCase); + static string CreateFile(string directory, string fileName) { Directory.CreateDirectory(directory); @@ -457,49 +336,25 @@ static string WithDirectorySeparator(string path) => sealed record ArtifactRecord( string Path, - string Role, - string IsPrimary, - string PrimaryArtifact, string PackageFormat, - string PackageType, - string PackageVersion, - string Architecture, - string RuntimeIdentifier, + string IsDirectory, string Signed, - string BundlePlatforms, string EntryPoint, - string DeploymentDirectory, + string RuntimeIdentifier, + string PlatformName, string ApplicationId, - string ApplicationIdGuid, string ApplicationTitle, string ApplicationName, string ApplicationDisplayVersion, - string ApplicationVersion) + string ApplicationVersion, + string Extended) { public static ArtifactRecord Parse(string line) { var fields = line.Split('|'); - Assert.Equal(19, fields.Length); - return new( - fields[0], - fields[1], - fields[2], - fields[3], - fields[4], - fields[5], - fields[6], - fields[7], - fields[8], - fields[9], - fields[10], - fields[11], - fields[12], - fields[13], - fields[14], - fields[15], - fields[16], - fields[17], - fields[18]); + Assert.Equal(13, fields.Length); + return new(fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], fields[6], + fields[7], fields[8], fields[9], fields[10], fields[11], fields[12]); } } } diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs index 78d345048908..316fdbd8d3be 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/WindowsTemplateTest.cs @@ -1,7 +1,6 @@ using System.Security; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; -using System.Xml.Linq; namespace Microsoft.Maui.IntegrationTests; @@ -51,8 +50,7 @@ public void BuildWindowsAppSDKSelfContained(string id, bool wasdkself, bool nets SetTestIdentifier(id, wasdkself, netself, packageType); if (TestEnvironment.IsMacOS) { - if (true) - return; // Skip: "This test is designed for testing a windows build." + if (true) return; // Skip: "This test is designed for testing a windows build." } var projectDir = TestDirectory; @@ -86,8 +84,7 @@ public void BuildWindowsRidGraph(string id, bool useRidGraph, string packageType SetTestIdentifier(id, useRidGraph, packageType); if (TestEnvironment.IsMacOS) { - if (true) - return; // Skip: "This test is designed for testing a windows build." + if (true) return; // Skip: "This test is designed for testing a windows build." } var projectDir = TestDirectory; @@ -120,8 +117,7 @@ public void PublishUnpackaged(string id, string framework, string config, bool u SetTestIdentifier(id, framework, config, usesRidGraph); if (!TestEnvironment.IsWindows) { - if (true) - return; // Skip: "Running Windows templates is only supported on Windows." + if (true) return; // Skip: "Running Windows templates is only supported on Windows." } var projectDir = TestDirectory; @@ -168,8 +164,7 @@ public void PublishPackaged(string id, string framework, string config) SetTestIdentifier(id, framework, config); if (!TestEnvironment.IsWindows) { - if (true) - return; // Skip: "Running Windows templates is only supported on Windows." + if (true) return; // Skip: "Running Windows templates is only supported on Windows." } var projectDir = TestDirectory; @@ -232,8 +227,7 @@ public void ApplicationArtifactsAreAvailableForMauiBuildAndPublish(string packag SetTestIdentifier(packageType); if (!TestEnvironment.IsWindows) { - if (true) - return; // Skip: "Running Windows templates is only supported on Windows." + if (true) return; // Skip: "Running Windows templates is only supported on Windows." } var projectDir = TestDirectory; @@ -286,8 +280,7 @@ public void ApplicationArtifactsIncludeBundleStoreUploadAndAppInstaller() SetTestIdentifier(nameof(ApplicationArtifactsIncludeBundleStoreUploadAndAppInstaller)); if (!TestEnvironment.IsWindows) { - if (true) - return; // Skip: "Running Windows templates is only supported on Windows." + if (true) return; // Skip: "Running Windows templates is only supported on Windows." } const string certificatePassword = "application-artifacts-test"; @@ -327,71 +320,9 @@ public void ApplicationArtifactsIncludeBundleStoreUploadAndAppInstaller() var artifactLines = File.ReadAllLines(publishArtifactsFile); var artifacts = artifactLines.Select(WindowsArtifact.Parse).ToArray(); AssertApplicationArtifacts(artifactLines, "MSIX", published: true); - Assert.Contains(artifacts, artifact => artifact.Role == "Bundle" && artifact.Path.EndsWith(".msixbundle", StringComparison.OrdinalIgnoreCase)); - Assert.Contains(artifacts, artifact => artifact.Role == "StoreUpload" && artifact.Path.EndsWith(".msixupload", StringComparison.OrdinalIgnoreCase)); - Assert.Contains(artifacts, artifact => artifact.Role == "DeploymentManifest" && artifact.Path.EndsWith(".appinstaller", StringComparison.OrdinalIgnoreCase)); - } - - [Fact] - public void StandaloneWindowsAppSdkApplicationCanReferenceApplicationArtifactsPackage() - { - SetTestIdentifier(nameof(StandaloneWindowsAppSdkApplicationCanReferenceApplicationArtifactsPackage)); - if (!TestEnvironment.IsWindows) - { - if (true) - return; // Skip: "Running Windows templates is only supported on Windows." - } - - var projectDir = TestDirectory; - var projectFile = Path.Combine(projectDir, "StandaloneWindowsApp.csproj"); - var buildArtifactsFile = Path.Combine(projectDir, "build-application-artifacts.txt"); - var publishArtifactsFile = Path.Combine(projectDir, "publish-application-artifacts.txt"); - var windowsAppSdkVersion = GetWindowsAppSdkPackageVersion(); - - File.WriteAllText(Path.Combine(projectDir, "Program.cs"), """ - namespace StandaloneWindowsApp; - - internal static class Program - { - [STAThread] - static void Main() - { - } - } - """); - File.WriteAllText(projectFile, $""" - - - {DotNetCurrent}-windows10.0.19041.0 - WinExe - win-x64 - None - com.example.standalonewindowsapp - Standalone Windows App - 7.8.9 - 10 - - - - - - {GetApplicationArtifactWriters(buildArtifactsFile, publishArtifactsFile)} - - """); - - Assert.True( - DotnetInternal.Build(projectFile, "Debug", target: "WriteBuildApplicationArtifacts", properties: BuildProps, output: _output), - "The standalone Windows App SDK project failed to collect build ApplicationArtifact items."); - AssertApplicationArtifacts(File.ReadAllLines(buildArtifactsFile), "None", published: false); - - Assert.True( - DotnetInternal.Publish(projectFile, "Debug", properties: BuildProps, output: _output), - "The standalone Windows App SDK project failed to publish."); - AssertApplicationArtifacts(File.ReadAllLines(publishArtifactsFile), "None", published: true); - - var assetsFile = File.ReadAllText(Path.Combine(projectDir, "obj", "project.assets.json")); - Assert.DoesNotContain("Microsoft.Maui.Core/", assetsFile, StringComparison.OrdinalIgnoreCase); - Assert.DoesNotContain("Microsoft.Maui.Resizetizer/", assetsFile, StringComparison.OrdinalIgnoreCase); + Assert.Contains(artifacts, artifact => artifact.Format == "msixbundle" && artifact.Path.EndsWith(".msixbundle", StringComparison.OrdinalIgnoreCase)); + Assert.Contains(artifacts, artifact => artifact.Format == "msixupload" && artifact.Path.EndsWith(".msixupload", StringComparison.OrdinalIgnoreCase)); + Assert.Contains(artifacts, artifact => artifact.Format == "appinstaller" && artifact.Path.EndsWith(".appinstaller", StringComparison.OrdinalIgnoreCase)); } static void AddApplicationArtifactWriters(string projectFile, string buildArtifactsFile, string publishArtifactsFile) @@ -409,13 +340,13 @@ static string GetApplicationArtifactWriters(string buildArtifactsFile, string pu """; @@ -429,31 +360,31 @@ static void AssertApplicationArtifacts(string[] artifactLines, string packageTyp artifact.Path.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}", StringComparison.OrdinalIgnoreCase)); Assert.All(artifacts, artifact => { - Assert.False(string.IsNullOrWhiteSpace(artifact.Role)); Assert.False(string.IsNullOrWhiteSpace(artifact.Format)); - Assert.Equal(packageType, artifact.PackageType, ignoreCase: true); + Assert.Equal("Windows", artifact.PlatformName); + Assert.False(string.IsNullOrWhiteSpace(artifact.EntryPoint)); Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationId)); Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationTitle)); Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationDisplayVersion)); Assert.False(string.IsNullOrWhiteSpace(artifact.ApplicationVersion)); }); - var primary = Assert.Single(artifacts.Where(artifact => artifact.Role == "Primary")); - Assert.Equal(packageType == "None" ? "exe" : "msix", primary.Format, ignoreCase: true); - if (published && packageType == "None") - Assert.Contains($"{Path.DirectorySeparatorChar}publish{Path.DirectorySeparatorChar}", primary.Path, StringComparison.OrdinalIgnoreCase); - - Assert.Contains(artifacts, artifact => artifact.Role == "PayloadDirectory"); - if (packageType == "MSIX") + if (packageType == "None") { - Assert.Equal("true", primary.Signed, ignoreCase: true); - Assert.False(string.IsNullOrWhiteSpace(primary.PackageVersion)); - Assert.Contains(artifacts, artifact => artifact.Role == "Certificate"); - Assert.Contains(artifacts, artifact => artifact.Role == "InstallScript"); + var directory = Assert.Single(artifacts); + Assert.Equal("directory", directory.Format); + Assert.Equal("true", directory.IsDirectory, ignoreCase: true); + Assert.Equal("false", directory.Signed, ignoreCase: true); + Assert.True(File.Exists(Path.Combine(directory.Path, directory.EntryPoint)), $"Expected '{directory.EntryPoint}' in '{directory.Path}'."); + if (published) + Assert.Equal("publish", Path.GetFileName(Path.TrimEndingDirectorySeparator(directory.Path)), ignoreCase: true); } else { - Assert.Equal("false", primary.Signed, ignoreCase: true); + var package = Assert.Single(artifacts, artifact => artifact.Format == "msix"); + Assert.Equal("false", package.IsDirectory, ignoreCase: true); + Assert.Equal("true", package.Signed, ignoreCase: true); + Assert.All(artifacts, artifact => Assert.Contains(artifact.Format, new[] { "msix", "msixbundle", "msixupload", "appinstaller" })); } } @@ -472,22 +403,15 @@ static void CreateSigningCertificate(string path, string password) File.WriteAllBytes(path, certificate.Export(X509ContentType.Pfx, password)); } - static string GetWindowsAppSdkPackageVersion() - { - var versionsFile = Path.Combine(TestEnvironment.GetMauiDirectory(), "eng", "Versions.props"); - var versions = XDocument.Load(versionsFile); - return versions.Descendants("MicrosoftWindowsAppSDKPackageVersion").Single().Value; - } - static string Escape(string value) => SecurityElement.Escape(value) ?? string.Empty; sealed record WindowsArtifact( string Path, - string Role, string Format, - string PackageType, - string PackageVersion, + string IsDirectory, string Signed, + string EntryPoint, + string PlatformName, string ApplicationId, string ApplicationTitle, string ApplicationDisplayVersion, diff --git a/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj b/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj deleted file mode 100644 index b9d882dd3869..000000000000 --- a/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/Microsoft.Maui.ApplicationArtifacts.Windows.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - true - false - Dependency - Microsoft.Maui.ApplicationArtifacts.Windows - Windows Application Artifacts - MSBuild targets that expose final Windows App SDK application outputs through the ApplicationArtifact item. - - - - - - - diff --git a/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets b/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets deleted file mode 100644 index ded8fdfd38ff..000000000000 --- a/src/Workload/Microsoft.Maui.ApplicationArtifacts.Windows/buildTransitive/Microsoft.Maui.ApplicationArtifacts.Windows.targets +++ /dev/null @@ -1,490 +0,0 @@ - - - - <_MicrosoftMauiWindowsApplicationArtifactsEnabled - Condition="'$(EnableWindowsApplicationArtifacts)' != 'false' - and '$(MicrosoftWindowsAppSDKPackageDir)' != '' - and '$(MSBuildProjectExtension)' != '.wapproj' - and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' - and ('$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe')">true - - - _CollectMicrosoftMauiWindowsApplicationArtifacts; - $(GetApplicationArtifactsDependsOn) - - - - - - - - - - - - - - - <_MicrosoftMauiWindowsCollectingForPublish>true - - - - - - - - - - - <_MicrosoftMauiWindowsPrimaryArtifact>$([System.IO.Path]::GetFullPath('$(PublishDir)$(TargetName).exe')) - <_MicrosoftMauiWindowsDeploymentDirectory>$([System.IO.Path]::GetFullPath('$(PublishDir)')) - - - - - - - Primary - true - $(_MicrosoftMauiWindowsPrimaryArtifact) - exe - $(WindowsPackageType) - $(_MicrosoftMauiWindowsPackageVersion) - $(_MicrosoftMauiWindowsArchitecture) - $(RuntimeIdentifier) - $(_MicrosoftMauiWindowsSigned) - $(AppxBundlePlatforms) - $(_MicrosoftMauiWindowsEntryPoint) - $(_MicrosoftMauiWindowsDeploymentDirectory) - $(_MicrosoftMauiWindowsApplicationId) - $(_MicrosoftMauiWindowsApplicationIdGuid) - $(_MicrosoftMauiWindowsApplicationTitle) - $(_MicrosoftMauiWindowsApplicationName) - $(_MicrosoftMauiWindowsApplicationDisplayVersion) - $(_MicrosoftMauiWindowsApplicationVersion) - <_MicrosoftMauiWindowsApplicationArtifact>true - - - - PayloadDirectory - false - $(_MicrosoftMauiWindowsPrimaryArtifact) - directory - $(WindowsPackageType) - $(_MicrosoftMauiWindowsPackageVersion) - $(_MicrosoftMauiWindowsArchitecture) - $(RuntimeIdentifier) - $(_MicrosoftMauiWindowsSigned) - $(AppxBundlePlatforms) - $(_MicrosoftMauiWindowsEntryPoint) - $(_MicrosoftMauiWindowsDeploymentDirectory) - $(_MicrosoftMauiWindowsApplicationId) - $(_MicrosoftMauiWindowsApplicationIdGuid) - $(_MicrosoftMauiWindowsApplicationTitle) - $(_MicrosoftMauiWindowsApplicationName) - $(_MicrosoftMauiWindowsApplicationDisplayVersion) - $(_MicrosoftMauiWindowsApplicationVersion) - <_MicrosoftMauiWindowsApplicationArtifact>true - - - - - - - - - <_MicrosoftMauiWindowsApplicationArtifactRaw Remove="@(_MicrosoftMauiWindowsApplicationArtifactRaw)" /> - <_MicrosoftMauiWindowsReportedOutput Remove="@(_MicrosoftMauiWindowsReportedOutput)" /> - <_MicrosoftMauiWindowsApplicationArtifactNormalized Remove="@(_MicrosoftMauiWindowsApplicationArtifactNormalized)" /> - <_MicrosoftMauiWindowsApplicationArtifactDistinct Remove="@(_MicrosoftMauiWindowsApplicationArtifactDistinct)" /> - - - - - - - - - - - - - - - - - - - - <_MicrosoftMauiWindowsPackageVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestVersion)' != ''">$(_MicrosoftMauiWindowsManifestVersion) - <_MicrosoftMauiWindowsPackageVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsPackageVersion)' == ''">$(AppxManifestIdentityVersion) - - <_MicrosoftMauiWindowsApplicationId Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestIdentity)' != ''">$(_MicrosoftMauiWindowsManifestIdentity) - <_MicrosoftMauiWindowsApplicationId Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsApplicationId)' == '' and '$(AppxManifestIdentityName)' != ''">$(AppxManifestIdentityName) - <_MicrosoftMauiWindowsApplicationId Condition="'$(_MicrosoftMauiWindowsApplicationId)' == '' and '$(ApplicationId)' != ''">$(ApplicationId) - <_MicrosoftMauiWindowsApplicationId Condition="'$(_MicrosoftMauiWindowsApplicationId)' == ''">$(AssemblyName) - - <_MicrosoftMauiWindowsApplicationTitle Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestDisplayName)' != ''">$(_MicrosoftMauiWindowsManifestDisplayName) - <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == '' and '$(ApplicationTitle)' != ''">$(ApplicationTitle) - <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == '' and '$(ApplicationName)' != ''">$(ApplicationName) - <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == '' and '$(AssemblyTitle)' != ''">$(AssemblyTitle) - <_MicrosoftMauiWindowsApplicationTitle Condition="'$(_MicrosoftMauiWindowsApplicationTitle)' == ''">$(AssemblyName) - - <_MicrosoftMauiWindowsApplicationName Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestDisplayName)' != ''">$(_MicrosoftMauiWindowsManifestDisplayName) - <_MicrosoftMauiWindowsApplicationName Condition="'$(_MicrosoftMauiWindowsApplicationName)' == '' and '$(ApplicationName)' != ''">$(ApplicationName) - <_MicrosoftMauiWindowsApplicationName Condition="'$(_MicrosoftMauiWindowsApplicationName)' == '' and '$(ApplicationTitle)' != ''">$(ApplicationTitle) - <_MicrosoftMauiWindowsApplicationName Condition="'$(_MicrosoftMauiWindowsApplicationName)' == ''">$(AssemblyName) - - <_MicrosoftMauiWindowsApplicationDisplayVersion - Condition="'$(WindowsPackageType)' != 'None' - and $([System.Text.RegularExpressions.Regex]::IsMatch('$(_MicrosoftMauiWindowsPackageVersion)', '^\d+\.\d+\.\d+\.\d+$'))">$([System.Text.RegularExpressions.Regex]::Replace('$(_MicrosoftMauiWindowsPackageVersion)', '^(\d+\.\d+\.\d+)\.(\d+)$', '$1')) - <_MicrosoftMauiWindowsApplicationVersion - Condition="'$(WindowsPackageType)' != 'None' - and $([System.Text.RegularExpressions.Regex]::IsMatch('$(_MicrosoftMauiWindowsPackageVersion)', '^\d+\.\d+\.\d+\.\d+$'))">$([System.Text.RegularExpressions.Regex]::Replace('$(_MicrosoftMauiWindowsPackageVersion)', '^(\d+\.\d+\.\d+)\.(\d+)$', '$2')) - <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsApplicationDisplayVersion)' == ''">$(_MicrosoftMauiWindowsPackageVersion) - <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsApplicationVersion)' == ''">$(ApplicationVersion) - - <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(ApplicationDisplayVersion)' != ''">$(ApplicationDisplayVersion) - <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationDisplayVersion)' == '' and '$(InformationalVersion)' != ''">$(InformationalVersion) - <_MicrosoftMauiWindowsApplicationDisplayVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationDisplayVersion)' == ''">$(Version) - <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(ApplicationVersion)' != ''">$(ApplicationVersion) - <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationVersion)' == '' and '$(FileVersion)' != ''">$(FileVersion) - <_MicrosoftMauiWindowsApplicationVersion Condition="'$(WindowsPackageType)' == 'None' and '$(_MicrosoftMauiWindowsApplicationVersion)' == ''">$(AssemblyVersion) - - <_MicrosoftMauiWindowsApplicationIdGuid - Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(_MicrosoftMauiWindowsApplicationId)', '^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}|\{[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\}|[0-9a-fA-F]{32})$'))">$(_MicrosoftMauiWindowsApplicationId) - - <_MicrosoftMauiWindowsArchitecture Condition="'$(PackageArchitecture)' != ''">$(PackageArchitecture) - <_MicrosoftMauiWindowsArchitecture Condition="'$(_MicrosoftMauiWindowsArchitecture)' == '' and '$(PlatformTarget)' != ''">$(PlatformTarget) - <_MicrosoftMauiWindowsArchitecture Condition="'$(_MicrosoftMauiWindowsArchitecture)' == ''">$(Platform) - <_MicrosoftMauiWindowsSigned Condition="'$(WindowsPackageType)' == 'None'">false - <_MicrosoftMauiWindowsSigned Condition="'$(_MicrosoftMauiWindowsSigned)' == '' and '$(AppxPackageSigningEnabled)' != ''">$(AppxPackageSigningEnabled) - <_MicrosoftMauiWindowsSigned Condition="'$(_MicrosoftMauiWindowsSigned)' == ''">false - - <_MicrosoftMauiWindowsEntryPoint Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsManifestExecutable)' != ''">$(_MicrosoftMauiWindowsManifestExecutable) - <_MicrosoftMauiWindowsEntryPoint Condition="'$(WindowsPackageType)' != 'None' and '$(_MicrosoftMauiWindowsEntryPoint)' == ''">$(_MicrosoftMauiWindowsManifestEntryPoint) - <_MicrosoftMauiWindowsEntryPoint Condition="'$(WindowsPackageType)' == 'None'">$(TargetName).exe - - - - <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(AppxPackageOutput)' != '' and Exists('$(AppxPackageOutput)')">$([System.IO.Path]::GetFullPath('$(AppxPackageOutput)')) - <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(_MicrosoftMauiWindowsPrimaryArtifact)' == '' and '$(AppxMainPackageOutput)' != '' and Exists('$(AppxMainPackageOutput)')">$([System.IO.Path]::GetFullPath('$(AppxMainPackageOutput)')) - <_MicrosoftMauiWindowsDeploymentDirectory Condition="'$(AppxPackageTestDir)' != '' and Exists('$(AppxPackageTestDir)')">$([System.IO.Path]::GetFullPath('$(AppxPackageTestDir)')) - - - - <_MicrosoftMauiWindowsPublishExecutable>$(PublishDir)$(TargetName).exe - <_MicrosoftMauiWindowsPublishExecutable Condition="!Exists('$(_MicrosoftMauiWindowsPublishExecutable)')">$(PublishDir)$(AssemblyName).exe - <_MicrosoftMauiWindowsBuildExecutable>$(TargetDir)$(TargetName).exe - <_MicrosoftMauiWindowsTargetPathExtension Condition="'$(TargetPath)' != ''">$([System.IO.Path]::GetExtension('$(TargetPath)')) - <_MicrosoftMauiWindowsBuildExecutable Condition="!Exists('$(_MicrosoftMauiWindowsBuildExecutable)') and '$(TargetPath)' != '' and '$(_MicrosoftMauiWindowsTargetPathExtension)' == '.exe'">$(TargetPath) - <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(_MicrosoftMauiWindowsCollectingForPublish)' == 'true' and '$(PublishDir)' != '' and Exists('$(_MicrosoftMauiWindowsPublishExecutable)')">$([System.IO.Path]::GetFullPath('$(_MicrosoftMauiWindowsPublishExecutable)')) - <_MicrosoftMauiWindowsPrimaryArtifact Condition="'$(_MicrosoftMauiWindowsPrimaryArtifact)' == '' and Exists('$(_MicrosoftMauiWindowsBuildExecutable)')">$([System.IO.Path]::GetFullPath('$(_MicrosoftMauiWindowsBuildExecutable)')) - <_MicrosoftMauiWindowsDeploymentDirectory Condition="'$(_MicrosoftMauiWindowsCollectingForPublish)' == 'true' and '$(PublishDir)' != '' and Exists('$(PublishDir)')">$([System.IO.Path]::GetFullPath('$(PublishDir)')) - <_MicrosoftMauiWindowsDeploymentDirectory Condition="'$(_MicrosoftMauiWindowsDeploymentDirectory)' == '' and '$(TargetDir)' != '' and Exists('$(TargetDir)')">$([System.IO.Path]::GetFullPath('$(TargetDir)')) - - - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxPackageOutput)" - Condition="'$(AppxPackageOutput)' != '' and Exists('$(AppxPackageOutput)')" - ArtifactRole="Primary" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxMainPackageOutput)" - Condition="'$(AppxMainPackageOutput)' != '' and Exists('$(AppxMainPackageOutput)')" - ArtifactRole="Primary" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxPackageItem)" - Condition="Exists('%(FinalAppxPackageItem.Identity)')" - ArtifactRole="Primary" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxPackageTestDir)" - Condition="'$(AppxPackageTestDir)' != '' and Exists('$(AppxPackageTestDir)')" - ArtifactRole="PayloadDirectory" - PackageFormat="directory" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxBundleOutput)" - Condition="'$(AppxBundleOutput)' != '' and Exists('$(AppxBundleOutput)')" - ArtifactRole="Bundle" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadBundleOutput)" - Condition="'$(AppxUploadBundleOutput)' != '' and Exists('$(AppxUploadBundleOutput)')" - ArtifactRole="Bundle" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxStoreContainer)" - Condition="'$(AppxStoreContainer)' != '' and Exists('$(AppxStoreContainer)')" - ArtifactRole="StoreUpload" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadPackageOutput)" - Condition="'$(AppxUploadPackageOutput)' != '' and Exists('$(AppxUploadPackageOutput)')" - ArtifactRole="StoreUpload" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadMainPackageOutput)" - Condition="'$(AppxUploadMainPackageOutput)' != '' and Exists('$(AppxUploadMainPackageOutput)')" - ArtifactRole="StoreUpload" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxUploadPackageItem)" - Condition="Exists('%(FinalAppxUploadPackageItem.Identity)')" - ArtifactRole="StoreUpload" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(AppInstallerFilePath)" - Condition="Exists('%(AppInstallerFilePath.Identity)')" - ArtifactRole="DeploymentManifest" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxSymbolPackageOutput)" - Condition="'$(AppxSymbolPackageOutput)' != '' and Exists('$(AppxSymbolPackageOutput)')" - ArtifactRole="Symbols" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxUploadSymbolPackageOutput)" - Condition="'$(AppxUploadSymbolPackageOutput)' != '' and Exists('$(AppxUploadSymbolPackageOutput)')" - ArtifactRole="Symbols" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxSymbolPackageItem)" - Condition="Exists('%(FinalAppxSymbolPackageItem.Identity)')" - ArtifactRole="Symbols" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(FinalAppxUploadSymbolPackageItem)" - Condition="Exists('%(FinalAppxUploadSymbolPackageItem.Identity)')" - ArtifactRole="Symbols" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(AppxPackagePublicKeyFile)" - Condition="'$(AppxPackagePublicKeyFile)' != '' and Exists('$(AppxPackagePublicKeyFile)')" - ArtifactRole="Certificate" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(LandingPagePath)" - Condition="'$(LandingPagePath)' != '' and Exists('$(LandingPagePath)')" - ArtifactRole="LandingPage" /> - - - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(_MicrosoftMauiWindowsPrimaryArtifact)" - Condition="'$(_MicrosoftMauiWindowsPrimaryArtifact)' != ''" - ArtifactRole="Primary" - PackageFormat="exe" /> - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="$(_MicrosoftMauiWindowsDeploymentDirectory)" - Condition="'$(_MicrosoftMauiWindowsDeploymentDirectory)' != ''" - ArtifactRole="PayloadDirectory" - PackageFormat="directory" /> - - - - <_MicrosoftMauiWindowsApplicationArtifactTargetDir Condition="'$(TargetDir)' != ''">$([System.IO.Path]::GetFullPath('$(TargetDir)')) - <_MicrosoftMauiWindowsApplicationArtifactTargetDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactTargetDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactTargetDir)')) - <_MicrosoftMauiWindowsApplicationArtifactTargetDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactTargetDir.ToLowerInvariant()) - - <_MicrosoftMauiWindowsApplicationArtifactOutDir Condition="'$(OutDir)' != ''">$([System.IO.Path]::GetFullPath('$(OutDir)')) - <_MicrosoftMauiWindowsApplicationArtifactOutDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactOutDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactOutDir)')) - <_MicrosoftMauiWindowsApplicationArtifactOutDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactOutDir.ToLowerInvariant()) - - <_MicrosoftMauiWindowsApplicationArtifactPublishDir Condition="'$(PublishDir)' != ''">$([System.IO.Path]::GetFullPath('$(PublishDir)')) - <_MicrosoftMauiWindowsApplicationArtifactPublishDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPublishDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactPublishDir)')) - <_MicrosoftMauiWindowsApplicationArtifactPublishDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactPublishDir.ToLowerInvariant()) - - <_MicrosoftMauiWindowsApplicationArtifactPackageDir Condition="'$(AppxPackageDir)' != ''">$([System.IO.Path]::GetFullPath('$(AppxPackageDir)')) - <_MicrosoftMauiWindowsApplicationArtifactPackageDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactPackageDir)')) - <_MicrosoftMauiWindowsApplicationArtifactPackageDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactPackageDir.ToLowerInvariant()) - - <_MicrosoftMauiWindowsApplicationArtifactPackageTestDir Condition="'$(AppxPackageTestDir)' != ''">$([System.IO.Path]::GetFullPath('$(AppxPackageTestDir)')) - <_MicrosoftMauiWindowsApplicationArtifactPackageTestDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDir)')) - <_MicrosoftMauiWindowsApplicationArtifactPackageTestDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDir.ToLowerInvariant()) - - <_MicrosoftMauiWindowsApplicationArtifactUploadDir Condition="'$(AppxUploadPackageDir)' != ''">$([System.IO.Path]::GetFullPath('$(AppxUploadPackageDir)')) - <_MicrosoftMauiWindowsApplicationArtifactUploadDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactUploadDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactUploadDir)')) - <_MicrosoftMauiWindowsApplicationArtifactUploadDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactUploadDir.ToLowerInvariant()) - - <_MicrosoftMauiWindowsApplicationArtifactIntermediateDir Condition="'$(IntermediateOutputPath)' != ''">$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)')) - <_MicrosoftMauiWindowsApplicationArtifactIntermediateDir Condition="'$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDir)' != ''">$([MSBuild]::EnsureTrailingSlash('$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDir)')) - <_MicrosoftMauiWindowsApplicationArtifactIntermediateDirComparable>$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDir.ToLowerInvariant()) - - - - <_MicrosoftMauiWindowsReportedOutput Include="@(InstallerFileWrites)"> - <_Source>InstallerFileWrites - - <_MicrosoftMauiWindowsReportedOutput Include="@(PackagingFileWrites)"> - <_Source>PackagingFileWrites - - <_MicrosoftMauiWindowsReportedOutput Include="@(AllBuiltSideloadPackages)"> - <_Source>AllBuiltSideloadPackages - - <_MicrosoftMauiWindowsReportedOutput Include="@(AllBuiltUploadPackages)"> - <_Source>AllBuiltUploadPackages - - <_MicrosoftMauiWindowsReportedOutput Include="@(AppInstallerFileWrites)"> - <_Source>AppInstallerFileWrites - - - <_MicrosoftMauiWindowsReportedOutput Update="@(_MicrosoftMauiWindowsReportedOutput)"> - <_ComparablePath>$([System.String]::Copy('%(FullPath)').ToLowerInvariant()) - <_ExtensionLower>$([System.String]::Copy('%(Extension)').ToLowerInvariant()) - <_IsFinalOutput>false - <_IsIntermediateOutput>false - - <_MicrosoftMauiWindowsReportedOutput Update="@(_MicrosoftMauiWindowsReportedOutput)"> - <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactTargetDirComparable)' != '' - and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactTargetDirComparable)'))">true - <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactOutDirComparable)' != '' - and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactOutDirComparable)'))">true - <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPublishDirComparable)' != '' - and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactPublishDirComparable)'))">true - <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageDirComparable)' != '' - and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactPackageDirComparable)'))">true - <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDirComparable)' != '' - and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactPackageTestDirComparable)'))">true - <_IsFinalOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactUploadDirComparable)' != '' - and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactUploadDirComparable)'))">true - <_IsIntermediateOutput Condition="'$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDirComparable)' != '' - and $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').StartsWith('$(_MicrosoftMauiWindowsApplicationArtifactIntermediateDirComparable)'))">true - - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') - and ('%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.msixbundle' - or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appxbundle')" - ArtifactRole="Bundle" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') - and ('%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.msixupload' - or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appxupload' - or ('%(_MicrosoftMauiWindowsReportedOutput._Source)' == 'AllBuiltUploadPackages' - and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' != '.msixbundle' - and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' != '.appxbundle'))" - ArtifactRole="StoreUpload" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') - and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appinstaller'" - ArtifactRole="DeploymentManifest" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') - and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.appxsym'" - ArtifactRole="Symbols" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') - and '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.cer'" - ArtifactRole="Certificate" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') - and ('%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.ps1' - or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.psd1' - or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.cmd' - or '%(_MicrosoftMauiWindowsReportedOutput._ExtensionLower)' == '.bat')" - ArtifactRole="InstallScript" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)') - and ($([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').Contains('\dependencies\')) - or $([System.String]::Copy('%(_MicrosoftMauiWindowsReportedOutput._ComparablePath)').Contains('/dependencies/')))" - ArtifactRole="DependencyPackage" /> - - <_MicrosoftMauiWindowsApplicationArtifactRaw Include="@(_MicrosoftMauiWindowsReportedOutput->'%(FullPath)')" - Condition="'%(_MicrosoftMauiWindowsReportedOutput._IsFinalOutput)' == 'true' - and '%(_MicrosoftMauiWindowsReportedOutput._IsIntermediateOutput)' != 'true' - and Exists('%(_MicrosoftMauiWindowsReportedOutput.Identity)')" - ArtifactRole="Support" /> - - - - <_MicrosoftMauiWindowsApplicationArtifactRaw Update="@(_MicrosoftMauiWindowsApplicationArtifactRaw)" - Condition="'%(_MicrosoftMauiWindowsApplicationArtifactRaw.PackageFormat)' == '' - and '%(_MicrosoftMauiWindowsApplicationArtifactRaw.Extension)' != ''"> - $([System.String]::Copy('%(_MicrosoftMauiWindowsApplicationArtifactRaw.Extension)').TrimStart('.').ToLowerInvariant()) - - <_MicrosoftMauiWindowsApplicationArtifactRaw Update="@(_MicrosoftMauiWindowsApplicationArtifactRaw)" - Condition="'%(_MicrosoftMauiWindowsApplicationArtifactRaw.PackageFormat)' == ''"> - file - - - <_MicrosoftMauiWindowsApplicationArtifactNormalized - Include="@(_MicrosoftMauiWindowsApplicationArtifactRaw->'%(FullPath)')" - KeepMetadata="ArtifactRole;PackageFormat" /> - - - - - - - - - %(_MicrosoftMauiWindowsApplicationArtifactDistinct.ArtifactRole) - true - false - %(_MicrosoftMauiWindowsApplicationArtifactDistinct.Identity) - $(_MicrosoftMauiWindowsPrimaryArtifact) - %(_MicrosoftMauiWindowsApplicationArtifactDistinct.PackageFormat) - $(WindowsPackageType) - $(_MicrosoftMauiWindowsPackageVersion) - $(_MicrosoftMauiWindowsArchitecture) - $(RuntimeIdentifier) - $(_MicrosoftMauiWindowsSigned) - $(AppxBundlePlatforms) - $(_MicrosoftMauiWindowsEntryPoint) - $(_MicrosoftMauiWindowsDeploymentDirectory) - $(_MicrosoftMauiWindowsApplicationId) - $(_MicrosoftMauiWindowsApplicationIdGuid) - $(_MicrosoftMauiWindowsApplicationTitle) - $(_MicrosoftMauiWindowsApplicationName) - $(_MicrosoftMauiWindowsApplicationDisplayVersion) - $(_MicrosoftMauiWindowsApplicationVersion) - <_MicrosoftMauiWindowsApplicationArtifact>true - - - - - diff --git a/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json b/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json index 819cb6573140..832cba86cb96 100644 --- a/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json +++ b/src/Workload/Microsoft.NET.Sdk.Maui.Manifest/WorkloadManifest.in.json @@ -73,7 +73,6 @@ "description": ".NET MAUI SDK for Windows", "extends": [ "maui-blazor" ], "packs": [ - "Microsoft.Maui.ApplicationArtifacts.Windows", "Microsoft.Maui.Graphics.Windows" ] } @@ -120,10 +119,6 @@ "win-arm64": "Microsoft.Maui.Graphics.Win2D.WinUI.Desktop" } }, - "Microsoft.Maui.ApplicationArtifacts.Windows": { - "kind": "library", - "version": "@VERSION@" - }, "Microsoft.Maui.Resizetizer": { "kind": "library", "version": "@VERSION@" diff --git a/src/Workload/README.md b/src/Workload/README.md index e86e69a90fc5..4b0a6443d949 100644 --- a/src/Workload/README.md +++ b/src/Workload/README.md @@ -88,8 +88,6 @@ installed: * `maui-macos` * `maui-windows` -The `maui-windows` workload also installs `Microsoft.Maui.ApplicationArtifacts.Windows`, a targets-only package that exposes final modern Windows App SDK build and publish outputs as `@(ApplicationArtifact)`. The package can be referenced directly by non-MAUI Windows App SDK applications; classic `.wapproj` projects are outside its scope. - `maui-android` simply extends the `android` workload, adding the Android-specific platform implementation for MAUI.