Bug 39721 - "Failed to add reference to 'Xamarin.Forms.Core.Design'" when adding XF 2.1.0.6529 NuGet in Windows 81 project
Summary: "Failed to add reference to 'Xamarin.Forms.Core.Design'" when adding XF 2.1.0...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.1.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-17 12:47 UTC by Harikrishnan
Modified: 2016-04-26 18:43 UTC (History)
4 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:
VERIFIED FIXED

Description Harikrishnan 2016-03-17 12:47:36 UTC
"Failed to add reference to 'Xamarin.Forms.Core.Design'" when adding XF 2.1.0.6529 NuGet in Windows 81 project in Xamarin.Forms. I have attached my output directory image for reference. Can anyone let me know what can be done to avoid this error?

Error message when using the NuGet Package Manager:

Attempting to gather dependencies information for package 'Xamarin.Forms.2.1.0.6529' with respect to project 'FormsTestbedSample.Windows81', targeting 'Windows,Version=v8.1'
Attempting to resolve dependencies for package 'Xamarin.Forms.2.1.0.6529' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Xamarin.Forms.2.1.0.6529'
Resolved actions to install package 'Xamarin.Forms.2.1.0.6529'
Package 'Xamarin.Forms.2.1.0.6529' already exists in folder 'D:\FormsTestbedSample\packages'
Install failed. Rolling back...
Package 'Xamarin.Forms.2.1.0.6529 : ' does not exist in project 'FormsTestbedSample.Windows81'
Failed to add reference to 'Xamarin.Forms.Core.Design'.
========== Finished ==========



Error message when using the Package Manager Console:

PM> Install-Package Xamarin.Forms
Attempting to gather dependencies information for package 'Xamarin.Forms.2.1.0.6529' with respect to project 'FormsTestbedSample.Windows81', targeting 'Windows,Version=v8.1'
Attempting to resolve dependencies for package 'Xamarin.Forms.2.1.0.6529' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Xamarin.Forms.2.1.0.6529'
Resolved actions to install package 'Xamarin.Forms.2.1.0.6529'
Package 'Xamarin.Forms.2.1.0.6529' already exists in folder 'D:\FormsTestbedSample\packages'
Install failed. Rolling back...
Package 'Xamarin.Forms.2.1.0.6529 : ' does not exist in project 'FormsTestbedSample.Windows81'
Install-Package : Failed to add reference to 'Xamarin.Forms.Core.Design'.
At line:1 char:1
+ Install-Package Xamarin.Forms
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand


I tried to install the NuGet both by using the NuGet Package Manager and by using the Package Manager Console. Am using Visual Studio 2015 Update 1 professional.
Comment 1 E.Z. Hart [MSFT] 2016-03-17 17:38:39 UTC
(In reply to Harikrishnan from comment #0)
> "Failed to add reference to 'Xamarin.Forms.Core.Design'" when adding XF
> 2.1.0.6529 NuGet in Windows 81 project in Xamarin.Forms. I have attached my
> output directory image for reference. Can anyone let me know what can be
> done to avoid this error?
> 

You might b in a bad state from a previous version of XF which had some nuget reference issues. If you clean your solution, delete your 'packages' folder, and do a 'Restore Nuget Packages', does the problem persist?
Comment 2 Harikrishnan 2016-03-21 07:04:37 UTC
I am sure I do not have any NuGet reference issues. It is because I have uninstalled all the previously installed NuGet and deleted the packages folder too. Cleared all the bin/obj folders in the PCL and the renderer projects. And then tried to install the latest NuGet packages both through the NuGet Package Manager and Package Manager Console. But the result is the same.
Comment 3 E.Z. Hart [MSFT] 2016-03-21 17:19:37 UTC
Does this happen if you create a brand new Windows 8.1 project in a new solution and install the Xamarin.Forms.2.1.0.6529 package?
Comment 4 Harikrishnan 2016-03-22 07:45:32 UTC
Yes, It does happen in a brand new Windows 8.1 project in a new solution. The packages are installing for the pcl and all other renderer projects expect the Windows81.
Comment 5 martin.robins 2016-03-24 13:28:06 UTC
I too had this problem with Xamarin.Forms 2.1.0.6529 and was able to resolve it as follows (based upon http://stackoverflow.com/questions/8314400/nuget-add-reference-error-while-installing-packages)...

- If Xamarin.Forms is already installed to any of the solution projects, uninstall it (from all of them).
- Clean the solution.
- Close Visual Studio.
- Open the solution folder, and delete the "packages" folder.
- Open the folder C:\Users\username\.nuget\pakages (where username is your own logon user folder) and delete the "Xamarin.Forms" folder.
- Reopen the solution in Visual Studio.
- Right click the solution and select "Manage NuGet Packages for Solution...".
- If the "Restore" button is visible (which it probably will be as we deleted all packages earlier), click it to restore "other" NuGet packages used within the solution.
- Reinstall Xamarin.Forms to the solution projects.
- Rebuild the solution.

In my case, Xamarin.Forms installed properly to all projects. The solution concerned contains PCL, Droid, iOS, UWP, Win81, WinPhone and WinPhone81 projects.

I believe the problem is actually caused by some kind of corruption during the original download of the package to the global cache "C:\Users\username\.nuget\pakages" from where all solution caches are populated.
Comment 6 E.Z. Hart [MSFT] 2016-03-29 17:27:42 UTC
This issue has been fixed for the next release of Xamarin.Forms. In the meantime, you can work around it by doing the following:

1. Install the Xamarin.Forms 2.1.0.6529 package to the rest of the projects in your solution as normal.
2. In your Windows 8.1 project, manually add references to the following libraries (located in \packages\Xamarin.Forms.2.1.0.6529\lib\win81):
Xamarin.Forms.Core.dll
Xamarin.Forms.Platform.dll
Xamarin.Forms.Platform.WinRT.dll
Xamarin.Forms.Platform.WinRT.Tablet.dll
Xamarin.Forms.Xaml.dll
Comment 7 Parmendra Kumar 2016-04-26 18:43:54 UTC
I have checked this issue with Xamarin.Forms 2.2.0-pre4 and I am not able to reproduce this issue.

Hence closing this issue.

If you facing same issue please feel free to reopen this issue.


Thanks.