Bug 53277 - Second level dependencies not being copied to target folder of main project when using MSBuild
Summary: Second level dependencies not being copied to target folder of main project w...
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 4.8.0 (C9)
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Ankit Jain
Depends on:
Reported: 2017-03-13 11:24 UTC by Matt Ward
Modified: 2017-03-14 16:08 UTC (History)
2 users (show)

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

ConsoleApp solution (89.21 KB, application/zip)
2017-03-13 11:25 UTC, Matt Ward
MSBuild output windows - build console project (805.89 KB, text/plain)
2017-03-14 13:57 UTC, Matt Ward
MSBuild output - mac - build console project (584.62 KB, text/plain)
2017-03-14 13:58 UTC, Matt Ward

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 Matt Ward 2017-03-13 11:24:46 UTC
From VSFeedback 832563

To reproduce:

Xamarin Studio 6.2 (build 1821) and VS for Mac
Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit)

MSBuild enabled in global preferences - Projects - Build - Build with MSBuild instead of xbuild

1) Create a solution with three projects:
    .NET Console project - ConsoleApp
    .NET Library project - CommonLib
    .NET Library project - XyzLib
2) Modify the project references so that:
   ConsoleApp references CommonLib
   CommonLib referencex XyzLib
3) In Common Lib modify the MyClass.cs so it uses the MyClass from the XyzLib:
    	public class MyClass
		XyzLib.MyClass instance;

		public MyClass ()
4) Build the solution - Build - Build All

Expected result:

ConsoleApp/bin/Debug folder contains CommonLib.dll and XyzLib.dll

Actual result:

ConsoleApp/bin/Debug folder contains just CommonLib.dll

a) If you run msbuild from the command line to build the solution then XyzLib.dll does get copied to the ConsoleApp/bin/Debug folder.
b) If you instead configure Xamarin Studio to use xbuild instead of MSBuild, close and re-open the solution, delete the files in ConsoleApp/bin/Debug, then build the solution using Xamarin Studio then XyzLib.dll does get copied to ConsoleApp/bin/Debug.

Xamarin Studio MSBuild diagnostic output:

MSBuild command line diagnostic output:
Comment 1 Matt Ward 2017-03-13 11:25:50 UTC
Created attachment 20288 [details]
ConsoleApp solution
Comment 2 Matt Ward 2017-03-14 13:51:53 UTC
This looks like it is an MSBuild problem. If you run MSBuild just for the console project then the XyzLib.dll is not copied to the ConsoleApp's bin/Debug folder.

 msbuild /t:Build ConsoleApp/ConsoleApp.csproj

If you xbuild this works. If you run msbuild for the solution then it works. If you try building just the project with MSBuild on Windows then it works (MSBuild 14 and 15).
Comment 3 Matt Ward 2017-03-14 13:57:41 UTC
Created attachment 20308 [details]
MSBuild output windows - build console project
Comment 4 Matt Ward 2017-03-14 13:58:50 UTC
Created attachment 20309 [details]
MSBuild output - mac - build console project
Comment 5 Ankit Jain 2017-03-14 16:08:05 UTC
This is already fixed in 4.9.x - https://github.com/mono/msbuild/commit/cff4013ba3a69f82dc0ae96b3e15af700d8f74ef .