Bug 23993 - Build task not updated after updating NuGet package for Forms
Summary: Build task not updated after updating NuGet package for Forms
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NuGet ()
Version: 5.5
Hardware: PC Mac OS
: Normal normal
Target Milestone: 5.8
Assignee: Matt Ward
Depends on:
Reported: 2014-10-22 12:07 UTC by John Miller [MSFT]
Modified: 2014-12-11 11:33 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 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 John Miller [MSFT] 2014-10-22 12:07:17 UTC

   Updating the NuGet package for Xamarin.Forms in the attached test case does not update the build task and it still fails to build from a bug in the older version of the assembly. 

**Steps to Reproduce:**

   1. Download the test case. 
   2. Open the test case in Xamarin Studio on Windows.
   3. Build the PCL project (XFormsTest). 
   4. The project will fail to build with an exception related to XamlG task failed...
   5. This was a bug that was fixed in a newer Forms package. 
   6. Update the Forms package by right clicking on it and choosing Update Package to get the bug fix.
   7. Re build the PCL project. 
   8. The build still fails with the same error.

**Actual Results:**

   The build still fails even after updating the NuGet package, which should have resolved it. 

**Expected Results:**

   The build should succeed because the newer package has the bug fix for the issue causing the failed build. 

**Build Date & Platform:**

   XS (Windows) 5.5.2

**Additional Information:**

   Deleting the bin and obj folders does not help. Restarting XS will workaround the issue. Updating the Package before the first build (step 3) might also workaround this issue.
Comment 2 Matt Ward 2014-10-22 19:00:44 UTC
I am assuming the error you are seeing is the following:

"\XFormsTest\XFormsTest\XFormsTest.csproj(56,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\..\packages\Xamarin.Forms.1.0.6186\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets."

If so this is been reported before:

Comment 3 John Miller [MSFT] 2014-10-23 12:50:07 UTC

Sorry, no that is not the error. The packages restore properly. But, the build still fails for a Forms related error "XamlG Task failed unexpectedly..."

That error is fixed in the new assembly, so its unexpected that the build would continue to fail after updating. Restarting XS allows the build to be successful. It is thought that this is because it is properly building with the new assembly.
Comment 4 Matt Ward 2014-10-27 14:33:16 UTC
OK I can reproduce it on Windows. 

I modified the PCL project by removing the <Target Name="EnsureNuGetPackageBuildImports">... section since I was seeing the "This project references NuGet package(s) that are missing on this computer." error instead of the XamlG error.
Comment 5 Matt Ward 2014-10-27 16:05:17 UTC
Tried calling the RemoteProjectBuilder.Refresh () after the new Xamarin.Forms MSBuild target has been added to the project on updating the NuGet package but that does not seem to fix the problem.

Closing and re-opening the solution seems to fix the problem.

Something (MSBuild?) seems to be using the old Xamarin.Forms.Build.Tasks.dll. NuGet itself fails to remove this file when updating the Xamarin.Forms NuGet package in the project if it was compiled before the update and generated the XamlG error.
Comment 6 Matt Ward 2014-12-11 11:33:10 UTC
Closing the solution kills the separate MSBuild.exe task. Now the NuGet addin will do the same if an MSBuild import is removed from the project when updating the NuGet package.

This should be fixed in:

Xamarin Studio: (master branch)
Commit: https://github.com/mono/monodevelop/commit/ac84628953fb45b87804c7c8112f52ff431e8a45