Skip to content

Commit

Permalink
[msbuild] Fix duplicate resources when bundling original resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Jan 16, 2025
1 parent 0e6a5b5 commit 02f3c64
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 5 additions & 0 deletions msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<Output TaskParameter="ItemsWithLogicalNames" ItemName="_BundleOriginalResourceWithLogicalName" />

</CollectPackLibraryResources>

<!-- make sure we don't bundle the same resource more than once -->
<ItemGroup>
<_BundleResourceWithLogicalName Remove="@(_BundleOriginalResourceWithLogicalName)" />
</ItemGroup>
</Target>

<!--
Expand Down
18 changes: 13 additions & 5 deletions tests/dotnet/UnitTests/ProjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,19 @@ public void BuildBindingsTest2 (ApplePlatform platform)
Assert.That (resourceBundle, Does.Exist, "Bundle existence");
}

[TestCase ("iOS", "monotouch")]
[TestCase ("tvOS", "monotouch")]
[TestCase ("macOS", "xammac")]
[TestCase ("MacCatalyst", "monotouch")]
public void BuildBundledResources (string platform, string prefix)
[TestCase ("iOS", "monotouch", true)]
[TestCase ("tvOS", "monotouch", true)]
[TestCase ("macOS", "xammac", true)]
[TestCase ("MacCatalyst", "monotouch", true)]
[TestCase ("iOS", "monotouch", false)]
[TestCase ("tvOS", "monotouch", false)]
[TestCase ("macOS", "xammac", false)]
[TestCase ("MacCatalyst", "monotouch", false)]
[TestCase ("iOS", "monotouch", null)]
[TestCase ("tvOS", "monotouch", null)]
[TestCase ("macOS", "xammac", null)]
[TestCase ("MacCatalyst", "monotouch", null)]
public void BuildBundledResources (string platform, string prefix, bool? bundleOriginalResources)
{
Configuration.IgnoreIfIgnoredPlatform (platform);
var assemblyName = "BundledResources";
Expand Down

0 comments on commit 02f3c64

Please sign in to comment.