Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove ios, windows8, and wp8 from Xamarin Forms PCL - nuget 3.0 opt-into error?

I'm working on a Xamarin Forms project. I want to target Android and Windows 10 UWP.

When I try to clean up the PCL by removing "Windows 8", "Windows Phone Silverlight 8", "Windows Phone 8.1", "Xamarin.ios", and "Xamarin.ios (classic)" from the PCL targets, I get the following nasty...

I'm really just trying to remove WP8 as I don't care about targeting it.

The project's targets cannot be changed. The selected targets require the project to opt-into NuGet 3.0 support, however, Visual Studio cannot automatically do this for you. Please uninstall all NuGet packages and try again.

How do you get a project to opt-into NuGet 3.0? Something else I should try?

environ: Xamarin Forms, VS2015

enter image description here

Thanks....

like image 460
Joe Healy Avatar asked Jan 27 '16 15:01

Joe Healy


People also ask

What is the version of Xamarin forms in NuGet?

Xamarin. Forms 5.0.0.2291 Prefix Reserved This package has a SemVer 2.0.0 package version: 5.0.0.2291+850-sha.d21728939-azdo.5530461. For projects that support PackageReference, copy this XML node into the project file to reference the package. The NuGet Team does not provide support for this client. Please contact its maintainers for support.

How to resolve Xamarin package did not load correctly error?

Reinstall the current stable version of Xamarin using from visualstudio.com. In cases where the above steps do not resolve the "package did not load correctly" error, here are a few more steps to try. Create a new Windows user account. Check if the Xamarin Visual Studio extensions load without error for the new user.

How to fix Xamarin Visual Studio extensions not working on Windows?

Create a new Windows user account. Check if the Xamarin Visual Studio extensions load without error for the new user. If those stored settings do indeed appear to be the problem, you can try backing them up and then deleting them.

What is the old version number of Xamarin forms?

In this example Xamarin.Forms.1.3.1.6296 is the old version number that was removed with the NuGet package update.


2 Answers

The solution that worked for me:

Uninstall Xamarin.Forms:

Right Click Solution -> Manage NuGet Packages -> Uninstall Xamarin.Forms -> Restart VS 

Then remove build platforms:

Right Click Solution -> Properties -> Build -> under Targeting select Change -> Remove platform(s) -> Restart VS 

Reinstall Xamarin.Forms:

Manage NuGet packages -> Search for Xamarin.Forms -> Install -> Restart VS 
like image 61
AKW Avatar answered Sep 24 '22 12:09

AKW


Another possible solution is to rename packages.config temporarily, change the PCL settings to the new target platforms, and then change the name of packages.config back again. This worked for me on my project using VS 2015. Can't take credit for this solution, read it on a blog some time back and just posting it here in case it helps someone. If I come across the blog article again I'll post the link here.

like image 36
SteveOLeary Avatar answered Sep 24 '22 12:09

SteveOLeary