Bug 38476 - Console project (Xamarin Studio) does not copy Resource assemblies from NuGet packages to output path.
Summary: Console project (Xamarin Studio) does not copy Resource assemblies from NuGet...
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Ankit Jain
Depends on:
Reported: 2016-02-04 23:31 UTC by Jon Goldberger [MSFT]
Modified: 2017-09-04 21:31 UTC (History)
5 users (show)

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

Test Project (7.16 KB, application/zip)
2016-02-04 23:31 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 GitHub or Developer Community 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] 2016-02-04 23:31:40 UTC
Created attachment 14902 [details]
Test Project

## Description

Console project (Xamarin Studio) does not copy Resource assemblies from NuGet packages to the output path.

(I am not sure if this is the correct product, so re-assign as need be)

## Steps to reproduce

1. Open the attached test project in Xamarin Studio (Mac) and build and allow NuGet packages to restore.

2. Open the bin/Debug folder for the project.

Expected result: Will see localization folders with Microsoft.Data.Edm.resources.dll and Microsoft.Data.OData.resources.dll assemblies in each.

Actual result: localization folders are not copied to output path. 

## Notes

This can be worked around by specifying an ItemGroup in the csproj file and copying the assemblies to the output directory for each of the assemblies e.g.:
> <ItemGroup>
>	<None Include="..\packages\Microsoft.Data.Edm.*\lib\net40\de\Microsoft.Data.Edm.resources.dll">
>		<Link>de\Microsoft.Data.Edm.resources.dll</Link>
>		<CopyToOutputDirectory>Always</CopyToOutputDirectory>
>	</None>

I have the xml to do this commented out in the .csproj file in the test project. YOu can uncomment that whole item group to get the assemblies copied to the output directory, so this is an easy workaround, but the customer notes that you would nat have to do this in Visual Studio with a referenced NuGet package that has Resource assemblies included. 

You can change this to an enhancement request if that seems more appropriate.

## Environment

=== Xamarin Studio ===

Version 5.10.2 (build 56)
Installation UUID: 964c531b-d928-456b-a9ae-e1f82266b360
	Mono 4.2.2 (explicit/996df3c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020030

=== Xamarin.Profiler ===

Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 7.2 (9548)
Build 7C68

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 962a050
Branch: master
Build date: 2016-01-29 16:59:11-0500

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		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)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin Inspector ===

Hash: 1b526e6
Branch: master
Build date: Tue Nov 17 20:54:30 UTC 2015

=== Build Information ===

Release ID: 510020056
Git revision: bb74ff467c62ded42b7b7ac7fdd2edc60f8647b0
Build date: 2016-01-26 16:24:41-05
Xamarin addins: 8b797d7ba24d5abab226c2cf9fda77f666263f1b
Build lane: monodevelop-lion-cycle6-c6sr1

=== Operating System ===

Mac OS X 10.11.3
Darwin Jons-iMac.local 15.3.0 Darwin Kernel Version 15.3.0
    Thu Dec 10 18:40:58 PST 2015
    root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64
Comment 1 Matt Ward 2016-02-08 18:27:47 UTC
This seems to be an xbuild problem so I think the category is correct. 

Running xbuild from the command line, using Mono 4.2.2, the resource assemblies are not copied. Xamarin Studio on Windows will build the project and copy the resource assemblies to the bin/Debug directory.
Comment 2 Brandon Risell 2017-05-10 21:57:40 UTC
I am also running into this issue. Switching to MSBuild in Xamarin Studio, or using Visual Studio for Mac solves the issue. The problem now is our CI service, which is using xbuild. I did a similar fix as the above, but just did an AfterBuild copy in the csproj for now.
Comment 3 Ankit Jain 2017-05-10 22:19:41 UTC
xbuild has been deprecated. Try using `msbuild` on your CI service. The command lines are compatible, so just replace `xbuild` with `msbuild`.