Bug 32987 - [XF 1.4.4] Generated .g.cs files for XAML that use the outdated "MSBuild:Compile" "Custom Tool" are no longer seen by Visual Studio IntelliSense
Summary: [XF 1.4.4] Generated .g.cs files for XAML that use the outdated "MSBuild:Comp...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-08-11 22:08 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-04-13 18:44 UTC (History)
7 users (show)

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

Test case (264.20 KB, application/zip)
2015-08-11 22:08 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Zip Xamarin Logs (996.11 KB, application/octet-stream)
2015-08-12 08:38 UTC, Udham Singh

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 or GitHub 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-08-11 22:08:34 UTC
Created attachment 12460 [details]
Test case

[XF 1.4.4] Generated .g.cs files for XAML that use the outdated "MSBuild:Compile" "Custom Tool" are no longer seen by Visual Studio IntelliSense

I am filing this bug to disambiguate this "known issue" from Bug 32341. I suspect this bug can be marked immediately as RESOLVED ANSWERED.

To the Xamarin.Forms team: of course feel free to add any follow-up comments or corrections before resolving the bug.

## The correct way to fix the problem in the attached test case (I believe)

Change the "Custom Tool" property on "FormsApp1\Page1.xaml" from `MSBuild:Compile` to `MSBuild:UpdateDesignTimeXaml`.

As mentioned on the Xamarin.Forms 1.3.0 release "Important notes":

> Generators for XAML pages should to be updated to use the new tool
> MSBuild:UpdateDesignTimeXaml instead of MSBuild:Compile

> [1] http://forums.xamarin.com/discussion/29934/xamarin-forms-1-3-0-released/p1

## Regression status: "regression" between 1.4.3 and 1.4.4


I have put "regression" in quotation marks because this appears to be an intentional change (as forewarned by the XF 1.3.0 release notes).

## About the test case

This is the same test case from Bug 32341, with two little changes:

1. I updated the Xamarin.Forms package references to XF

2. I changed the "Custom Tool" property on "FormsApp1\Page1.xaml" from `MSBuild:UpdateDesignTimeXaml` to `MSBuild:Compile`.

## Steps to reproduce (the same as Bug 32341)

1. Open the attached test case.

2. Restore the NuGet packages.

3. Make a modification to the `Page1.xaml` file and save it. It is sufficient
just to overwrite "Page1" with "Page1" and save the file.

4. Navigate to the `Page1.xaml.cs` file to check if the types from `.g.cs` are
seen by IntelliSense.

## Results (the same as Bug 32341)

Step 3 does _not_ produce a `.g.cs` file. The `obj\Debug\` folder does not
contain any `.g.cs` files.

Building the FormsApp1 project _does_ produce a `.g.cs` file:
> obj\Debug\FormsApp1.Page1.xaml.g.cs

## "Hacky" alternate workaround

It is _possible_ to make the `MSBuild:Compile` custom tool "imitate" the expected behavior. In particular, you can add the following lines at the bottom of the `.csproj` file for the project that contains the XAML pages:

> <PropertyGroup>
>   <CompileDependsOn>
>     PrepareResources;
>     $(CompileDependsOn);
>   </CompileDependsOn>
> </PropertyGroup>

But again, this is not the recommended way to solve the issue, and it might lead to various secondary problems in either the current or future Xamarin.Forms releases.

## Additional version info (brief)

### Windows 8.1 (64-bit) in VMWare Fusion 6.0.6

Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.6.00081

Xamarin   3.11.836.0 (ed5c750)
Comment 1 Udham Singh 2015-08-12 08:38:55 UTC
Created attachment 12471 [details]
Zip Xamarin Logs

I have checked this issue with the help of test steps given in bug description and able to reproduce the reported behavior.

Screencast : http://www.screencast.com/t/dBMK81LKN

Environment Info : 


Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Professional

Xamarin   3.11.868.0 (d98cdcb)
Comment 2 Chris King 2016-04-13 18:44:57 UTC
Thank you for your report. At this time there are no plans to implement any changes around this issue.