Bug 25811 - [XVS 3.9] Newly created Xamarin.Forms template projects fail to deploy to iOS unless you first change the active build configuration
Summary: [XVS 3.9] Newly created Xamarin.Forms template projects fail to deploy to iOS...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms ()
Version: 3.9
Hardware: PC Windows
: High blocker
Target Milestone: 4.0.0 (C6)
Assignee: Bugzilla
Depends on:
Reported: 2015-01-08 00:25 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2015-09-24 08:36 UTC (History)
13 users (show)

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

VS ide logs (222.07 KB, application/zip)
2015-01-08 05:01 UTC, Danish Akhtar

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 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 Brendan Zagaeski (Xamarin Team, assistant) 2015-01-08 00:25:29 UTC
Newly created Xamarin.Forms template projects fail to deploy to iOS unless you first change the build rules for the active solution platform.

Regression status: regression between XVS 3.8.150 and XVS 3.9.236.

The problem is introduced by the new feature in XamarinVS 3.9 that integrates the device list into the Run menu.

## Steps to reproduce

1. Create a new "Visual C# -> Mobile Apps -> Blank App (Xamarin.Forms Portable)" project in Visual Studio.

2. Right-click the iOS project in the Solution Explorer and select "Set as StartUp Project".

3. Select a device or simulator from the green arrow Run drop-down menu.

4. Click the green arrow Run button.

## Results

The build fails because:

a. The FormsApp1 PCL project is not set to build when the active platform of the solution is set to "iPhone" or "iPhoneSimulator" (under "Build -> Configuration Manager").


b. The active platform of the solution at step 4 is always set to either "iPhone" or "iPhoneSimulator" depending on the device chosen in step 3.

This causes the following error:
> Metadata file 'C:\Users\Windows User\Desktop\FormsApp1\FormsApp1\FormsApp1\bin\Debug\FormsApp1.dll' could not be found

## Old "good" results on Xamarin 3.8.150

It is not possible to select an iOS Simulator as the deployment target at step 3. You must select an iOS device because that is the active platform for the iOS project when the active platform of the solution is "Mixed Platforms".

The build succeeds and deploys to the iOS device because the active platform of the solution at step 4 is "Mixed Platforms" rather than "iPhone" or "iPhoneSimulator".

## Possible fixes

- Perhaps the Xamarin.Forms template project could be modified so that the FormsApp1 PCL project *is* set to build for the "iPhone" and "iPhoneSimulator" platforms.

- Maybe the XamarinVS extensions could select the "Mixed Platforms" platform by default rather than the "iPhone" or "iPhoneSimulator" platforms AND could change the active platform specifically for the _iOS project_ depending on the device selected at step 3 rather than the active platform for the _whole solution_.

## Version information
Xamarin (d6a2cae)
Xamarin.Android (49a04b966feb40dfdba49d57ba16249b66d606a6)
Xamarin.iOS (eb24bdcf5cba2c12b673a07e0a8cce368b9563b3)

Comment 2 Danish Akhtar 2015-01-08 05:00:38 UTC
I have checked this issue by following the steps mentioned in bug description and and getting the build error. Hence marking this as Confirmed.

Supplement info:
build log: https://gist.github.com/saurabh360/4c320e04374395a1d88e
screencast: http://www.screencast.com/t/9Ecc48jGh6
mtbserver log: https://gist.github.com/Mohit-Kheterpal/3771fcb8a6a4d3802a76

Environment info:
VS 2013
Xcode 5.1.1
Comment 3 Danish Akhtar 2015-01-08 05:01:27 UTC
Created attachment 9282 [details]
VS ide logs
Comment 5 Ian Ceicys 2015-01-14 18:17:01 UTC
Verified this bug and getting the VS Team's attention to getting this issue
fixed in the next release.
Comment 6 Joaquin Jares 2015-01-14 19:23:39 UTC
As Brendan pointed out we have something planned for 3.10. This is, afaik, not a regression. The problem always existed. The problem is that iPhone projects have an iPhone/iPhoneSimulator platform and PCLs (obviously) don't. We have no way of forcing the configuration for build, we did try and the API is simply not exposed. The solution is to have iPhone build as Any CPU (same as the PCL), but it's a big change and requires a lot of effort (and coordination with XS).
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2015-01-19 22:47:48 UTC
To discuss a bit more, the "regression status" of this bug is admittedly a little weird. The thing that has changed compared to 3.8 is just the Unified Devices menu. To put it another way, if (hypothetically) the Unified Devices menu were removed from 3.9.1, that would "solve" the problem described in this bug. Disabling the part of the Unified Devices feature that changes the active solution platform would also be sufficient as a temporary fix until 3.10. In that case, users would again need to select the active solution by hand (as in XVS 3.8). On the other hand, disabling that part of the feature now might cause more confusion than help.

The problem is that the new Unified Devices menu changes the number of steps required for a brand new user to deploy a Xamarin.Forms template project. The "Metadata file ... could not be found" error is probably fairly well-known by veteran Visual Studio users, so there's a chance that most users who are starting with Xamarin in Visual Studio will be able to solve the problem on their own. But:

a. Based on my (entirely informal) observations, Xamarin.Forms seems to be a common first entry point for brand new Xamarin users. As a result, making the first-run experience as smooth as possible for Xamarin.Forms might be advisable. XVS 3.9 has a stumbling block for this first-run experience that did not exist in XVS 3.8.

b. There might be some veteran users of Xamarin and Visual Studio who will be tripped up by this if they start a new Xamarin.Forms project.

All of that said, so far I haven't seen any complaints about this problem on the forums or in Desk. So I'd say this issue can perhaps be de-prioritized, especially if it would help free up more time for proofreading the debugger hang fixes.
Comment 8 Joaquin Jares 2015-01-19 23:08:02 UTC
There is something planned for 3.10 anyway.

But also, this problem always existed. It's also present in 3.8, and earlier. It may be more obvious because of the devices menu, but it's a structural problem with the way we do iOS, and I've been hearing about it since I started working for Xamarin... so I do think deprioritization is a good idea.
Comment 9 Ian Ceicys 2015-01-26 10:23:20 UTC
I agree that this bug, while important, requires a structure change to the way we handle iOS and will require significant changes, due to the conversations that have taken place this bug will not be a candidate for the current service release and I'll add it to the backlog for future consideration.
Comment 10 Jon Goldberger [MSFT] 2015-03-03 21:39:04 UTC
This occurred with a newly created iOS Unified Universal app project as well.
Comment 12 PJ 2015-03-19 16:14:46 UTC
3.10 was scratched and the only milestone tracked for what was the 3.10 release is VS2015-CTP6. Moving open 3.10 bugs to 3.11 for review.
Comment 15 Daniel Cazzulino 2015-07-29 11:02:23 UTC
Fixed in XMA@efcab9704a7c881b7fb5e4b5dd6db5c51ce40df8
Comment 16 Saurabh 2015-07-30 04:49:07 UTC
I have checked this Issue with latest XMA builds. iOS application of portable forms template getting deployed on build host. I am not getting any error. This is the screencast for the same: http://www.screencast.com/t/7yTYWqNRq8y
Xamarin Log: https://gist.github.com/saurabh360/3f2191360a90b706b06e

VS 2013/2015