Bug 27926 - File in Shared Project type with build action "Content" is not copied into the application bundle.
Summary: File in Shared Project type with build action "Content" is not copied into th...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 8.8.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Jeffrey Stedfast
URL:
Depends on:
Blocks:
 
Reported: 2015-03-11 16:52 UTC by Jon Goldberger [MSFT]
Modified: 2015-03-12 15:33 UTC (History)
4 users (show)

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


Attachments
Test Project (187.58 KB, application/zip)
2015-03-11 16:52 UTC, Jon Goldberger [MSFT]
Details


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 Jon Goldberger [MSFT] 2015-03-11 16:52:01 UTC
Created attachment 10279 [details]
Test Project

## Description

For iOS, in Visual Studio when a Shared Project (Actual Shared Project type) contains a text file with Build Action set to "Content," the file is in the application bundle after building and can be accessed by the iOS app. In Xamarin Studio this is not true. It seems like Xamarin Studio is trying to place the file outside of the app bundle as the build fails with the error 

>/Users/apple/Downloads/Test/Test.Shared/test.js: Error: The path '../Test.Shared/test.js' would result in a file outside of the app bundle and cannot be used. (Test.iOS)

For Android, the file is not copied into the apk from either Visual Studio or Xamarin Studio. However I note that even a text file in the Android app project itself with a build action set as "Content" does not get copied into the application bundle. 


## Steps to reproduce

1. Open the attached test project and restore packages.

2. Launch the iOS app project

Expected result: App will build and test.js file from the Test.Shared project will be included in the app bundle.

Actual result: build fails with above error. 


## Notes

I am not sure if this is supposed to be supported or not, just noting the different behavior, especially in iOS where having a Content file in the Shared Project did work. You can load the same test project into Visual Studio and launch the iOS app and see that the app builds and the test.js file is included in the app bundle.


## Version information:

=== Xamarin Studio ===

Version 5.8 (build 443)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 3.12.1 ((detached/b7764aa)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010000

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.Mac ===

Version: 1.10.0.21 (Business Edition)

=== Xamarin.Android ===

Version: 4.20.0.37 (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: 8.8.0.2 (Business Edition)
Hash: ccfcd59
Branch: 
Build date: 2015-03-10 02:20:32-0400

=== Build Information ===

Release ID: 508000443
Git revision: 73883239470cbe8e261c94d95f7c3d0452fd393b
Build date: 2015-03-10 07:22:51-04
Xamarin addins: a2ff7b617f09d9c45d8bbf3d010b5db0d7d36100

=== Operating System ===

Mac OS X 10.10.2
Darwin Jons-iMac.local 14.1.0 Darwin Kernel Version 14.1.0
    Thu Feb 26 19:26:47 PST 2015
    root:xnu-2782.10.73~1/RELEASE_X86_64 x86_64
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2015-03-11 17:02:57 UTC
See: http://developer.xamarin.com/guides/android/under_the_hood/build_process/#content
Comment 3 Mikayla Hutchinson [MSFT] 2015-03-11 21:54:16 UTC
Also, for iOS the Content build action has been deprecated in favour of BundleResource.
Comment 4 Sunil Kumar 2015-03-12 09:32:40 UTC
I have tried to reproduce this issue and getting the same error. I downloaded the attached test project and followed steps mentioned in bug description to reproduce this issue.

Screencast: http://www.screencast.com/t/pMV7hIjkn4
Error: https://gist.github.com/AkhileshKumar01/06c0faaad3e1d4e48516
IDE Log: https://gist.github.com/AkhileshKumar01/e75818c9bb63d9e79a95
Build Output: https://gist.github.com/AkhileshKumar01/d309882e025f80f29543

Environment info:
=== Xamarin Studio ===

Version 5.8 (build 443)
Installation UUID: 91997f85-0008-4b4c-9f53-c7f991fcdae3
Runtime:
	Mono 3.12.1 ((detached/b7764aa)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010000

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.8.0.2 (Business Edition)
Hash: ccfcd59
Branch: 
Build date: 2015-03-10 02:20:32-0400

=== Xamarin.Android ===

Version: 4.20.0.37 (Business Edition)
Android SDK: /Users/360_macmini/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		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.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

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

=== Xamarin.Mac ===

Version: 1.10.0.21 (Business Edition)

=== Build Information ===

Release ID: 508000443
Git revision: 73883239470cbe8e261c94d95f7c3d0452fd393b
Build date: 2015-03-10 07:22:51-04
Xamarin addins: a2ff7b617f09d9c45d8bbf3d010b5db0d7d36100

=== Operating System ===

Mac OS X 10.10.2
Darwin Apples-iMac.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 5 Jeffrey Stedfast 2015-03-12 15:33:17 UTC
This has already been fixed but requires a newer Mono (from git master)
Comment 6 Jeffrey Stedfast 2015-03-12 15:33:36 UTC
Oh, and it also requires a new Xamarin.iOS (8.10 at least)