Bug 27791 - Cannot build from the command line when specifying a configuration that is not shared by a referenced project
Summary: Cannot build from the command line when specifying a configuration that is no...
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.20.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Ankit Jain
Depends on:
Reported: 2015-03-09 15:27 UTC by John Miller [MSFT]
Modified: 2017-01-25 13:05 UTC (History)
3 users (show)

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 for Bug 27791 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description John Miller [MSFT] 2015-03-09 15:27:08 UTC

   When trying to build and create an APK from the command line with xbuild the build fails. The project references a project that does not have the same configuration. 

**Steps to Reproduce:**

   Download this sample: https://www.dropbox.com/s/e2vn0rrwgh6txis/Phoneword.zip?dl=0

   1. Run this command in Terminal

    > xbuild Phoneword_Droid/Phoneword_Droid.csproj /p:Configuration=Live /p:Platform=Android /t:PackageForAndroid

**Actual Results:**

   An error message when building:

/Library/Frameworks/Mono.framework/Versions/3.12.1/lib/mono/4.5/Microsoft.Common.targets: error : 'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: Live Platform: Android.

**Expected Results:**

   Build the project and create an APK

**Build Date & Platform:**

   XA 4.20
   Mono 3.12

**Additional Information:**

   MSBuild may require any referenced projects to have the _same_ configurations. Building the solution file instead of the project file is probably the solution for that, which uses the solution mappings. However, this means you can't add a target for PackageForAndroid or SignAndroidPackage, etc. The following does not work:

   xbuild Project.sln /p:Configuration=Live /t:ProjectName:PackageForAndroid

That seems to be the correct syntax stated here: https://msdn.microsoft.com/en-us/library/ms171486.aspx

Xamarin Studio does build the solution and project fine, so it seems possible using xbuild, but I could not figure out how XS is doing this.
Comment 1 asimk 2015-04-03 02:53:05 UTC
We are getting same error while running the command from terminal.

Supplement Info:
Terminal output: https://gist.github.com/sunil360/e9319918ba9e401c06d7

Build Info:
XA 4.20
Mono 3.12
XS 5.9 (build 388)
Comment 2 Nate Cook 2017-01-24 19:17:03 UTC
Same here. The only workaround I have found is to add the configuration in question to the referenced project, which is annoying because, as you mention, Xamarin Studio builds it just fine. Can we get an update on whether there are any plans to improve this? I agree that the proper solution seems to be to allow building the solution instead.
Comment 3 dean.ellis 2017-01-25 13:05:49 UTC
I don't think this is a Xamarin.Android issue per say. It looks more like an xbuild bug. Reassigning