Bug 31273 - Adding .xnb files (used by MonoGame) results in "None" build action for iOS
Summary: Adding .xnb files (used by MonoGame) results in "None" build action for iOS
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 5.9
Hardware: PC Mac OS
: --- normal
Target Milestone: master
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2015-06-21 15:42 UTC by victor.chelaru
Modified: 2015-06-22 15:40 UTC (History)
2 users (show)

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 victor.chelaru 2015-06-21 15:42:26 UTC
To reproduce:

1. Create an empty MonoGame "universal" iOS/Android project.
2. Right-click on the Content folder inside of <Android Project>/Assets/Content/, and select Add Files...
3. Add a .xnb file (such as robot.xnb)
4. Right-click and go to Properties on this newly-added file
5. Notice that the "Build action" is set to "AndroidAsset" (this is correct behavior)
6. Right-click on the Content folder inside of <iOS Project>/Content, and select Add Files...
7. Add a .xnb file (such as robot.xnb)
8. Right-click and go to Properties on this newly-added file
9. Notice that the "Build action" is set to "None" 

Actual Behavior: Build action for iOS projects is "None
Expected Behavior: Build action should be "BundleResource"

Note, this is the opposite of this older bug that I posted:
https://bugzilla.xamarin.com/show_bug.cgi?id=28481

The following .zip file contains .xnb files which can be added:

https://drive.google.com/file/d/0B_UmhnfYLrXJeHNWVnNYSnFDeUE/view?usp=sharing

This bug occurs in a very common path for MonoGame users.
Comment 1 Matt Ward 2015-06-22 12:07:56 UTC
Android does not have special support for .xnb files. What is happening for Android is that the Assets folder in the project is treated as a special folder and if a file is added to that folder then it automatically gets the build action of AndroidAsset.

iOS has some special folders but Content is not one of them as far as I am aware. For example, if you add a .xnb file to the Resources folder then it will have a build action of BundleResource.

You can also override the default build action when the file is added but that will not help if you do not know what build action to choose.
Comment 2 Jeffrey Stedfast 2015-06-22 15:40:40 UTC
The "None" build action was not iOS-specific, it was the default value for unknown file types.

I've changed Mac and iOS to override "None" to be "BundleResource" but I don't know if that's really expected behavior.

If you added those files to the Resources folder or the top-level project folder, they would have defaulted to "BundleResource".