Bug 44419 - Unable to build iOS .csproj due with xbuild or msbuild due to error : 'OutputPath' property is not set for this project.
Summary: Unable to build iOS .csproj due with xbuild or msbuild due to error : 'Output...
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: 4.6.0 (C8)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 4.8.0 (C9)
Assignee: Bugzilla
Depends on:
Reported: 2016-09-16 15:59 UTC by Peter Collins
Modified: 2016-09-16 16:30 UTC (History)
1 user (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 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 Peter Collins 2016-09-16 15:59:22 UTC
This appears to be related to some of the recent comments in Bug #25480. I'm unable to build an iOS csproj file that belongs to a cross platform solution with xbuild.

The error informs me that I don't have an OutputPath set, which is incorrect. The project has a PropertyGroup which matches the configuration and platform I am providing, and also defines an OutputPath[0]. Additionally, OutputPath is defined in both xbuild and msbuild diagnostic build output, however it still can't be reconciled and the build fails.

[0] https://github.com/xamarin/xamarin-forms-samples/blob/master/WorkingWithColors/iOS/WorkingWithColors.iOS.csproj#L39-L43

### Steps to reproduce ###
1. Download / clone https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithColors
2. nuget restore WorkingWithColors/WorkingWithColors.sln 
3. xbuild /p:Configuration=Debug /p:Platform=iPhone WorkingWithColors/iOS/WorkingWithColors.iOS.csproj

### Xbuild Output ###

### MSBuild Output ###

### Environment ###
macOS 10.11.6
Mono JIT compiler version 4.6.0 (mono-4.6.0-branch/746756c Thu Sep  8 05:39:12 EDT 2016)
Comment 1 Peter Collins 2016-09-16 16:30:20 UTC
Discussed this with Ankit, marking as resolved answered.

"The scenario is that `WorkingWithColors.iOS.csproj`(1) is being built and that references `WorkingWithColors.csproj`(2), so xbuild/msbuild tries to “resolve” that referenced project by trying to run a target for (2). Now, (1) has `OutputPath` set for `Debug|iPhone`, but (2) does not have `Debug|iPhone`, it has `Debug|AnyCPU` instead. And that is valid, because that (1)’s `config|platform` maps to (2)’s `config|platform`, but this *mapping* information is available in the `.sln` file! Which means that if you directly try to build the `csproj` then that mapping info is not available and (2) is built with `Debug|iPhone` and hence it has no `OutputPath` set!

IOW, there is configuration mapping involved here between projects, and that info is present in sln file, so you can’t build the csproj directly"