Bug 11109 - Resource files must be in root folder
Summary: Resource files must be in root folder
Status: RESOLVED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-13 06:50 UTC by David Lambert
Modified: 2013-03-13 12:51 UTC (History)
0 users

Tags:
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:
Status:
RESOLVED FIXED

Description David Lambert 2013-03-13 06:50:53 UTC
I would appreciate to be able to organize my resource files in subfolders.
Comment 1 Jeffrey Stedfast 2013-03-13 10:32:45 UTC
You can, you just have to set their LogicalNames to a toplevel path.

I.e. if you have:

Resources/
   Icons/
      AppIcon.icns


You just need to set AppIcon.icns's LogicalName to "AppIcon.icns" instead of the default, which would be "Icons/AppIcons.icns" because Mac OS X *requires* the app icon to be in the toplevel of the Resources directory in the app bundle.
Comment 2 David Lambert 2013-03-13 10:47:06 UTC
Alright I get it but I'm surprised Xamarin.Mac doesn't do that transparently.

What about images? I had to put all my images to the root too to see them in Xcode.
Comment 3 Jeffrey Stedfast 2013-03-13 12:45:36 UTC
You can place them inside of the "Resources" folder.

The problem is that Xcode will allow you to set an image from anywhere in the project, but when you try to run it, it fails unless the image is in the toplevel Resources folder.

We made it such that developers had to put images in the toplevel project folder (or inside the Resources folder) to prevent developers from getting confused as to why their images weren't loading in xibs.


In Xamarin Studio 4.0.2, when you select an App Icon (or any other icon for use by the Info.plist) it will add it to the project in the correct location (or ask you if it should move the file to the appropriate place if it is already part of the project).

If you'd like to create your own folder for icons or images, you can do that and then edit the .csproj to add  the folder to this line:

    <MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>

For example, if you have an "Icons" folder, you could change that line to:

    <MonoMacResourcePrefix>Resources;Icons</MonoMacResourcePrefix>


At some point, we will be adding the ability to set these folders in the UI but it's not there yet :-\
Comment 4 David Lambert 2013-03-13 12:51:09 UTC
By root I meant the Resources folder. If they are not at the root of the Resources folder I don't see them in Xcode as you said.  I was talking about organizing those in the resources folder itself.

Thanks for the info about the csproj. I really think Xamarin Studio should transparently manage resources between XS and Xcode.

David