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

后端 未结 8 1918
名媛妹妹
名媛妹妹 2020-12-01 13:30

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 Si

相关标签:
8条回答
  • 2020-12-01 14:01

    The best way to disable one of the builds is in Solution Explorer, Right Click the build you don't want included like Windows or WinPhone and click Unload Project. Then the that build will change to (unavailable)

    0 讨论(0)
  • 2020-12-01 14:02

    Per comments on the original question, there are a couple potential routes; one would be to try and remove all packages from the projects and make the necessary changes before re-adding them again.

    0 讨论(0)
  • 2020-12-01 14:03

    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.

    0 讨论(0)
  • 2020-12-01 14:04

    For me this is what fixed it: Look into packages.config file in that target project, and uninstall ALL installed packages. Then you'll be able to change the Targeting. Then re-install your packages.

    0 讨论(0)
  • 2020-12-01 14:13

    For my initial prototype I didn't want to waste time on another platforms; so:

    1. I started a new solution - "Blank App (Xamarin Forms Portable)"
    2. I used PackageManager to remove ALL packages from all projects
    3. I changed the Project Targets to exclude any Windows Mobile apps (it wanted to keep Windows 8.1; I think this was the .NET inclusion I wanted)
    4. I removed the 3 Windows projects
    5. I used PackageManager to readd "Xamarin.Forms" to all remaining projects - and it automatically added all the other packages that existed at startup

    Now my solution is only (really) targeting Android and iOS ....

    0 讨论(0)
  • 2020-12-01 14:16

    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
    
    0 讨论(0)
提交回复
热议问题