Skip to content

Commit f4879b8

Browse files
github-actions[bot]mattleibowPureWeen
authored
[release/8.0.1xx-sr7] Remove the 'Resources' prefix from BundleResource (#24015)
* Remove the 'Resources' prefix from BundleResource Fixes #23554 Prior to Maui 8.0.70, there was a bug that only removed the "Resources/" prefix, and not the correct "Platforms/iOS/Resource": #16734 This PR #23269 fixes the original issue, but now exposed the case where BundleResource were included in the root Resources folder instead of the Platforms/iOS/ folder. * Update Microsoft.Maui.Controls.SingleProject.targets * Update Microsoft.Maui.Controls.SingleProject.targets * Update Versions.props * Add a test # Conflicts: # src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs * string --------- Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Shane Neuville <[email protected]>
1 parent 911f058 commit f4879b8

File tree

3 files changed

+51
-2
lines changed

3 files changed

+51
-2
lines changed

Diff for: eng/Versions.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project>
22
<PropertyGroup>
33
<!-- The .NET product branding version -->
4-
<ProductVersion>8.0.71</ProductVersion>
4+
<ProductVersion>8.0.72</ProductVersion>
55
<MajorVersion>8</MajorVersion>
66
<MinorVersion>0</MinorVersion>
7-
<PatchVersion>71</PatchVersion>
7+
<PatchVersion>72</PatchVersion>
88
<SdkBandVersion>8.0.100</SdkBandVersion>
99
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
1010
<!-- Servicing builds have different characteristics for the way dependencies, baselines, and versions are handled. -->

Diff for: src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.SingleProject.targets

+18
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,24 @@
6161

6262
</Target>
6363

64+
<!--
65+
TEMPORARY workaround for the issue where the resource starts with the Resources/ prefix,
66+
either in the Identity or Link metadata. The fix is to assume that was not intended
67+
since that is how it worked in 8.0.60 and earlier.
68+
See: https://github.com/xamarin/xamarin-macios/issues/20968
69+
-->
70+
<Target Name="_MauiBefore_CollectBundleResources" BeforeTargets="_CollectBundleResources">
71+
<PropertyGroup>
72+
<_MauiOld_ResourcePrefix>$(_ResourcePrefix)</_MauiOld_ResourcePrefix>
73+
<_ResourcePrefix>Resources;$(_ResourcePrefix)</_ResourcePrefix>
74+
</PropertyGroup>
75+
</Target>
76+
<Target Name="_MauiAfter_CollectBundleResources" AfterTargets="_CollectBundleResources">
77+
<PropertyGroup>
78+
<_ResourcePrefix>$(_MauiOld_ResourcePrefix)</_ResourcePrefix>
79+
</PropertyGroup>
80+
</Target>
81+
6482
<!-- Import Maui Single Project property pages -->
6583
<PropertyGroup Condition="'$(MauiDesignTimeTargetsPath)' == ''">
6684
<MauiDesignTimeTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Maui\Maui.DesignTime.targets</MauiDesignTimeTargetsPath>

Diff for: src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs

+31
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,37 @@ public void BuildWindowsAppSDKSelfContained(string id, bool wasdkself, bool nets
237237
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
238238
}
239239

240+
[Test]
241+
[TestCase("maui", "ios")]
242+
[TestCase("maui", "maccatalyst")]
243+
[TestCase("maui-blazor", "ios")]
244+
[TestCase("maui-blazor", "maccatalyst")]
245+
public void BuildWithCustomBundleResource(string id, string framework)
246+
{
247+
var projectDir = TestDirectory;
248+
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj");
249+
250+
Assert.IsTrue(DotnetInternal.New(id, projectDir, DotNetCurrent),
251+
$"Unable to create template {id}. Check test output for errors.");
252+
253+
File.WriteAllText(Path.Combine(projectDir, "Resources", "testfile.txt"), "Something here :)");
254+
255+
FileUtilities.ReplaceInFile(projectFile,
256+
"</Project>",
257+
$"""
258+
<ItemGroup>
259+
<BundleResource Include="Resources\testfile.txt" />
260+
</ItemGroup>
261+
</Project>
262+
""");
263+
264+
var extendedBuildProps = BuildProps;
265+
extendedBuildProps.Add($"TargetFramework={DotNetCurrent}-{framework}");
266+
267+
Assert.IsTrue(DotnetInternal.Build(projectFile, "Debug", properties: extendedBuildProps, msbuildWarningsAsErrors: true),
268+
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
269+
}
270+
240271
[Test]
241272
[TestCase("maui", $"{DotNetCurrent}-ios", "ios-arm64")]
242273
public void PublishNativeAOT(string id, string framework, string runtimeIdentifier)

0 commit comments

Comments
 (0)