Bug 25761 - Updating the Forms nuget package leaves an Error XML element in the .csproj file that refers to the old version
Summary: Updating the Forms nuget package leaves an Error XML element in the .csproj f...
Status: RESOLVED DUPLICATE of bug 21865
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-01-06 20:36 UTC by Jon Goldberger [MSFT]
Modified: 2015-01-07 08:45 UTC (History)
5 users (show)

Tags:
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:
Status:
RESOLVED DUPLICATE of bug 21865

Description Jon Goldberger [MSFT] 2015-01-06 20:36:07 UTC
## Description

When updating Nuget packages in a Xamarin Forms project using Xamarin Studio on a Mac, an XML element is left in the .csproj file that refers to the old version. This is the element that remains and causes an error when building:

 <Error Condition="!Exists('..\..\packages\Xamarin.Forms.1.2.3.6257\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.1.2.3.6257\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets'))" />

This element was still in the .csproj file after updating to version 1.3.x.x of Xamarin Forms. either removing this Error element or manually changing the version to reflect the updated version resolves the issue.

## Steps to reproduce

1. Get the Xamarin Forms FormsGallery sample app. http://developer.xamarin.com/samples/FormsGallery/
2. Build and run and all should work fine.
3. Right click on the solution in the solution explorer and choose Update Packages
4. After update is complete, build the solution.

Expected result: Solution should build. 

Actual result: The following error is generated:

/Users/apple/git/xamarin-forms-samples/FormsGallery/FormsGallery/FormsGallery/FormsGallery.csproj: 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.2.3.6257/build/portable-win+net45+wp80+MonoAndroid10+MonoTouch10/Xamarin.Forms.targets. (FormsGallery)

## Note: this seems to happen very consistently. If there are four projects, i.e. PCL, Android, iOS, and WinPhone it is quite annoying to have to manually modify all of the .csproj files to either remove the Error element or change the version number.
Comment 1 Jon Goldberger [MSFT] 2015-01-06 20:37:24 UTC
My version info:

=== Xamarin Studio ===

Version 5.5.4 (build 15)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

=== Xamarin.Android ===

Version: 4.20.0.28 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: 8.4.0.47 (Business Edition)
Hash: 7244769
Branch: 
Build date: 2014-12-11 14:54:30-0500

=== Xamarin.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Build Information ===

Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8

=== Operating System ===

Mac OS X 10.10.1
Darwin Jons-iMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Prashant manu 2015-01-07 04:55:28 UTC
We have checked with the attached sample and getting same error 'This project references NuGet package(s) that are missing' after updating nuget package.

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

Supplement Info:
Error details: https://gist.github.com/saurabh360/8165ce41d40eefa63083
IDE log: https://gist.github.com/saurabh360/f2e1eff4c2c29c6f3f3f

Environment Info:
Xamarin Studio
Version 5.7 (build 661)
Installation UUID: 0b7eaebc-a0ed-4b58-81df-91e378cad28c
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

Apple Developer Tools
Xcode 6.2 (6736)
Build 6C86e

Xamarin.iOS
Version: 8.6.0.50 (Business Edition)
Hash: 561dfed
Branch: 
Build date: 2015-01-06 17:56:14-0500

Xamarin.Android
Version: 4.20.0.28 (Trial Edition)
Android SDK: /Users/Admin_Mac/Desktop/Anddk/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Xamarin.Mac
Version: 1.10.0.18 (Business Edition)

Build Information
Release ID: 507000661
Git revision: b70bab61da996da29045ea8ee8aed1a6faedbe78
Build date: 2015-01-05 16:31:31-05
Xamarin addins: 82f6c71490562d6cd125a09287f441902fdac3d7

Operating System
Mac OS X 10.10.2
Darwin Admin-Macs-Mac-mini.local 14.1.0 Darwin Kernel Version 14.1.0
    Thu Nov 13 18:36:56 PST 2014
    root:xnu-2782.10.65~2/RELEASE_X86_64 x86_64
Comment 3 Matt Ward 2015-01-07 08:45:37 UTC
This should be fixed in Xamarin Studio 5.8. The problem is that Visual Studio adds extra Error elements when NuGet packages are added. Xamarin Studio before the fix was made did not modify these Error elements when a NuGet package is updated or removed.

A short term fix before XS 5.8 is released would be to modify the projects on the Forms Gallery so they do not use the Error element nor the EnsureNuGetPackageBuildImports target.

*** This bug has been marked as a duplicate of bug 21865 ***