Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 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.
The end result of this structure is MSBuild looking for the target "GetBuiltProjectOutputRecursive" in all referenced projects, and failing to find the target.
It appears (Xamarin.Common.targets) that the build system collects outputs by calling MSBuild on each project, but this doesn't then load the project correctly when it is setup with multiple platform targets. "TargetPlatform" not being set, it then doesn't resolve the appropriate Xamarin imports.
I have included a reproduction project. This is on VS2017-RC3 with XVS 126.96.36.1998. I presume it happens on iOS as well, but I haven't gotten far enough to need to prove that.
I forgot to mention, "Android.targets" in the project is the workaround that I'm trying out. (It works for this sample, haven't yet tried in my larger project)
It's not unlike other project.json/csproj coexistence workarounds in that it ensures TargetFramework is set when calling to the bigger project.
EDIT ABOVE: I called out "TargetPlatform" not being set in calling the project reference, but writing this addendum I realized I meant to say TargetFramework.
I'm trying a repro to see if I understand properly.
@Adam while I try my own repro, you mention a reproduction project but I don't see any attachments in the bug.
Created attachment 19715 [details]
Here is a reproduction. While I mentioned using a .targets file to work around the build error, that ultimately raised too many other hassles. This includes a better proposed resolution in App2.csproj.
I lost track of this, sorry. I'll check it again. Thanks for the repro!
Fixed in 8bad02596fc110161d982c1620bfc118364749d2.
Will be included in RTW.
A manual workaround in the meantime is to modify the file at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Microsoft.Common.Targets\ImportAfter\Xamarin.Common.targets with the following:
<Target Name="GetBuiltProjectOutputRecursive" Returns="@(AllBuiltProjectOutputs)" DependsOnTargets="AssignProjectConfiguration">
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
<Output TaskParameter="TargetOutputs" ItemName="_RecursiveBuiltProjectOutputs" />