Bug 28106 - <Link>'ing Asset Catalogs does not work
Summary: <Link>'ing Asset Catalogs does not work
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 8.8.0
Hardware: Macintosh Mac OS
: Low enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Jeffrey Stedfast
: 30331 ()
Depends on:
Reported: 2015-03-17 09:23 UTC by Andrew Polkinghorn
Modified: 2017-01-26 17:01 UTC (History)
6 users (show)

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

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 Andrew Polkinghorn 2015-03-17 09:23:53 UTC

I am trying to add app icons and launch images via asset catalogs to multiple projects.

I have an "Images.xcassets" folder which contains an icon and launch image asset catalog of all my icon and launch screen images.

If I add my "Images.xcassets" folder by linking the folder and all of it's files I get the following error:

"Error: None of the input catalogs contained a matching app icon set named  "AppIcon". (Sample)"

However, if I add the same "Images.xcassets" folder by copying or moving all of it's files it compiles and works straight away.

I'm assuming this is because it is looking for my images in the "Resources" folder rather than following Xamarin Studio's file link to the appropriate location.

Is it possible to link asset images for an Xamarin project outside of it's Resources folder?

Kind regards,
Andrew Polkinghorn
Comment 1 Jeffrey Stedfast 2015-03-17 16:06:00 UTC
It's not possible to use Links, sorry.
Comment 2 Andrew Polkinghorn 2015-03-18 05:35:30 UTC

After contacting ios@support.com I was directed here to report this issue and was hoping for little more of a response than one line saying it's not possible.

Could you provide any more information on why this isn't possible?

Is this something that could be fixed if investigated? If so what are the next steps to get this bug investigated?

To give you a little background information, we package a lot of samples with our product that all have the same launch screen and icon images.

If we can't link these images from outside the Resources folder we would have to copy the same images into every one of our sample apps causing the size of our download to increase.

Kind regards,
Andrew Polkinghorn
Comment 3 Jeffrey Stedfast 2015-03-18 08:02:56 UTC
The way that asset catalogs are compiled is that the `actool` command from Xcode is run on a directory and not individual files, so the build system depends on the paths in the .csproj to be a physical directory and not use the <Link> feature.

The problem is that once you start <Link>'ing files into the virtual hierarchy that doesn't represent the physical locations, the build system will have to copy those files into a temporary directory and then compile the resulting directory.

Is it possible for me to make the build system smarter and support the use of <Link>'d files? Yes, and I can put it in my queue, but it's not a trivial problem for me to solve.

It would be far simpler for you to either copy the directory into your project or to use operating-system level symlinks (probably only available on Mac OS X - but it looks like you're already using Mac OS X, so no issues there) and it also means you can have a solution to your problem today :-)

Here's how you would use symlinks (not sure if you're a Unix guy, so I figured I'd explain how in case you're not familiar):

Open a terminal and navigate to your project directory where you'd like to add your Images.xcassets. Now all you need to do is run the following command:

    ln -s /path/to/your/real/Images.xcassets

This will create a symbolic link that you can then go into Xamarin Studio and do "File -> Add Existing Folder" and then select the Images.xcassets that you just created.

This is actually far better than the <Link> hack that .csproj files have :-)
Comment 4 Jeffrey Stedfast 2015-03-18 08:05:17 UTC
I'll put support for <Link> in my queue, but I would still recommend using symlinks.
Comment 5 Andrew Polkinghorn 2015-03-18 11:52:45 UTC

Thanks for the detailed response. It's greatly appreciated. :)

However, I have tried placing symlinks inside the Resources folder and get the same error:

"Error: None of the input catalogs contained a matching app icon set named "AppIcon". (Sample)"

I mainly wanted to bring this bug to your attention and check if you knew of any work around solutions that would prevent me from copying loads of assets.

I can copy the assets to each sample's Resource folder as a temporary solution.

Thanks again for your help.

Kind regards,
Andrew Polkinghorn
Comment 6 Jeffrey Stedfast 2015-05-22 07:30:36 UTC
*** Bug 30331 has been marked as a duplicate of this bug. ***
Comment 7 Dario 2015-05-26 14:04:49 UTC
I've tried using symlinks and am still getting the same error.
Comment 8 Jeffrey Stedfast 2015-08-13 16:28:45 UTC
If symlinks don't work, then you'll have to just physically copy the asset catalog directories into the project.
Comment 9 Jeffrey Stedfast 2017-01-20 20:58:36 UTC
PR submitted: https://github.com/xamarin/xamarin-macios/pull/1543
Comment 10 Jeffrey Stedfast 2017-01-26 16:38:07 UTC
This is now fixed in master, so I expect this to be in a stable release by later spring/early summer.
Comment 11 Dario 2017-01-26 17:01:59 UTC
How will we know that it's been released and which release it's in so we can update our projects accordingly?