Bug 28955 - Image assets (Image.imageset) in a referenced iOS library project are not compiled/copied into the app bundle.
Summary: Image assets (Image.imageset) in a referenced iOS library project are not com...
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 8.8.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-04-09 18:22 UTC by Jon Goldberger [MSFT]
Modified: 2015-04-10 20:17 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

test Project (1.96 MB, application/zip)
2015-04-09 18:22 UTC, Jon Goldberger [MSFT]
Verbose Build Output (195.87 KB, text/plain)
2015-04-09 18:23 UTC, Jon Goldberger [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jon Goldberger [MSFT] 2015-04-09 18:22:43 UTC
Created attachment 10697 [details]
test Project

## Description

When adding an imageset to an iOS Library project Unified), the image set is not compiled/copied to the iOS app project that references the iOS library with the imageset.

## Steps to reproduce

1. Open the attached test project(s) and deploy to iOS simulator or device.

Expected result: An image will be displayed.

Actual result: no image is displayed.

## Notes

I tried this with a Classic API Library and app project as well. In this case the library won't build with the error:

>Error: Asset Catalogs are not supported in iOS Library projects when using the Classic build system. Either upgrade to the Unified API or enable the MSBuild engine. (ClassicLibraryImageAssets)

Tried using MSBuild engine (has note in project options that MSBuild is "Unsupported for this project type") but this did not make a difference. Though the Library project built with MSBuild without the above error, the imageset was still not compiled/copied to the app bundle.

When an image set is on the actual app project, it is compiled to a file called Assets.car. This file is not present in the app bundle when the image set is in a library project. 

Verbose build output is attached.

## My environment:

=== Xamarin Studio ===

Version 5.8.2 (build 7)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
	Mono 3.12.1 ((detached/0849ec7)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010003

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 981acb3
Build date: 2015-03-25 14:21:05-0400

=== Build Information ===

Release ID: 508020007
Git revision: 067ed06873402cf780f8a0899bb332c2a1c0af22
Build date: 2015-03-27 14:17:13-04
Xamarin addins: 02510c4990dee3475c282b3182d588975a63ff07

=== Operating System ===

Mac OS X 10.10.3
Darwin Jons-iMac.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 1 Jon Goldberger [MSFT] 2015-04-09 18:23:20 UTC
Created attachment 10698 [details]
Verbose Build Output

Added Verbose Build Output
Comment 2 Jeffrey Stedfast 2015-04-10 15:28:03 UTC
The problem is that the Platform is AnyCPU and so no --platform option gets passed to actool which means it outputs no files.

He'll need to edit his Library build configurations and set them to Debug|iPhone and Release|iPhone.

Xamarin.iOS 8.12 will have a fix for this.

commit 875d23b3e383d5cbe83d366e0ac4736b99d30510
Author: Jeffrey Stedfast <jeff@xamarin.com>
Date:   Fri Apr 10 15:18:37 2015 -0400

    [msbuild] If the ComputedPlatform is AnyCPU, replace it with iPhone
Comment 3 Jon Goldberger [MSFT] 2015-04-10 15:52:44 UTC
Thanks Jeff, yup that fixes it. :-)
Comment 4 Jon Goldberger [MSFT] 2015-04-10 20:17:52 UTC
Workaround (fixes the test project):
1. Open the project options for the iOS library project.

2. Go to the Build->Configurations page.

3. Copy the Debug and the Release configurations two times each to add Debug|iPhone, Debug|iPhoneSimulator, Release|iPhone, Release|iPhoneSimulator configuration | platform combinations

4. Open the Solution Options and go to the Build->Configurations->Configuration Mappings page.

5. Set the Library project to use the newly added Configuration | Platform combinations.

6. Now the image assets should be compiled and copied into the iOS app bundle as they would be if in the app project itself. 

I have made a screencast for clarity (Xamarin Studio): http://screencast.com/t/l921EfpsvD