NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 253 forks source link

Cannot install SkiaSharp on F# Xamarin projects. #8205

Open Happypig375 opened 5 years ago

Happypig375 commented 5 years ago

Details about Problem

Environment Microsoft Visual Studio Community 2019 Version 16.1.2 VisualStudio.16.Release/16.1.2+29001.49 Microsoft .NET Framework Version 4.7.03190 Installed Version: Community Visual C++ 2019 00435-60000-00000-AA759 Microsoft Visual C++ 2019 Application Insights Tools for Visual Studio Package 9.1.00429.1 Application Insights Tools for Visual Studio ASP.NET and Web Tools 2019 16.1.429.50124 ASP.NET and Web Tools 2019 Azure App Service Tools v3.0.0 16.1.429.50124 Azure App Service Tools v3.0.0 C# Tools 3.1.1-beta4-19281-06+58a4b1e79aea28115e66b06f850c83a3f1fcb6d3 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Extensibility Message Bus 1.1.77 (master@24013d5) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package Mono Debugging for Visual Studio 16.1.1 (2473f22) Support for debugging Mono processes with Visual Studio. NuGet Package Manager 5.1.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info TypeScript Tools 16.0.10506.2004 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 3.1.1-beta4-19281-06+58a4b1e79aea28115e66b06f850c83a3f1fcb6d3 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual F# Tools 10.4 for F# 4.6 16.1.0-beta.19253.3+42526fe359672a05fd562dc16a91a43d0fe047a7 Microsoft Visual F# Tools 10.4 for F# 4.6 Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio VisualStudio.Mac 1.0 Mac Extension for Visual Studio Xamarin 16.1.0.543 (d16-1@34a619991) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 16.1.0.418 (remotes/origin/d16-1@5b958bb10) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 16.2.112 (4db4af4) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 9.3.0.22 (HEAD/8e7764fdf) Xamarin.Android Reference Assemblies and MSBuild support. Mono: mono/mono/2018-08@3cb36842fc4 Java.Interop: xamarin/java.interop/d16-1@5ddc3e3 LibZipSharp: grendello/LibZipSharp/d16-1@44de300 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-1@acabd26 Xamarin.iOS and Xamarin.Mac SDK 12.10.0.153 (750a879) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Worked before? If so, with which NuGet version: Before updating to Visual Studio 16.1.2

Detailed repro steps so we can see the same problem

  1. Create a new F# iOS Single View App

  2. Install SkiaSharp

Attempting to gather dependency information for package 'SkiaSharp.Views.Forms.1.68.0' with respect to project 'SkiaSharpFSharp', targeting 'Xamarin.iOS,Version=v1.0' Gathering dependency information took 22.1 sec Attempting to resolve dependencies for package 'SkiaSharp.Views.Forms.1.68.0' with DependencyBehavior 'Lowest' Resolving dependency information took 0 ms Resolving actions to install package 'SkiaSharp.Views.Forms.1.68.0' Resolved actions to install package 'SkiaSharp.Views.Forms.1.68.0' GET https://api.nuget.org/v3-flatcontainer/xamarin.forms/3.3.0.912540/xamarin.forms.3.3.0.912540.nupkg Adding package 'SkiaSharp.1.68.0' to folder 'C:\Users\hadri\source\repos\SkiaSharpFSharp\packages' OK https://api.nuget.org/v3-flatcontainer/xamarin.forms/3.3.0.912540/xamarin.forms.3.3.0.912540.nupkg 775ms Installing Xamarin.Forms 3.3.0.912540. Added package 'SkiaSharp.1.68.0' to folder 'C:\Users\hadri\source\repos\SkiaSharpFSharp\packages' Install failed. Rolling back... Package 'SkiaSharp.1.68.0' does not exist in project 'SkiaSharpFSharp' Removing package 'SkiaSharp.1.68.0' from folder 'C:\Users\hadri\source\repos\SkiaSharpFSharp\packages' Removed package 'SkiaSharp.1.68.0' from folder 'C:\Users\hadri\source\repos\SkiaSharpFSharp\packages' Executing nuget actions took 6.58 sec Failed to add reference to 'SkiaSharp'. Parameter cannot be null. Parameter name: project Time Elapsed: 00:00:29.3461112 ========== Finished ==========


## Other suggested things

I don't know

### Verbose Logs

C:\Users\hadri\source\repos\SkiaSharpFSharp\SkiaSharpFSharp>dotnet add package SkiaSharp C:\Users\hadri\source\repos\SkiaSharpFSharp\SkiaSharpFSharp\SkiaSharpFSharp.fsproj(70,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.700\Xamarin\iOS\Xamarin.iOS.FSharp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. Unable to create dependency graph file for project 'C:\Users\hadri\source\repos\SkiaSharpFSharp\SkiaSharpFSharp\SkiaSharpFSharp.fsproj'. Cannot add package reference. Usage: dotnet add package [options]

Arguments:

The project file to operate on. If a file is not specified, the command will search the current directory for one. The package reference to add. Options: -h, --help Show command line help. -v, --version The version of the package to add. -f, --framework Add the reference only when targeting a specific framework. -n, --no-restore Add the reference without performing restore preview and compatibility check. -s, --source The NuGet package source to use during the restore. --package-directory The directory to restore packages to. --interactive Allows the command to stop and wait for user input or action (for example to complete authentication). ```
Happypig375 commented 5 years ago

Apparently Visual Studio messed up some files.

Happypig375 commented 5 years ago

Attempting to extract the nupkg into the packages folder myself:

Restoring packages for C:\Users\hadri\Source\Repos\App\App\App.fsproj...
Restoring packages for C:\Users\hadri\Source\Repos\App\App.UWP\App.UWP.csproj...

Attempting to gather dependency information for package 'SkiaSharp.1.68.0' with respect to project 'App.Android', targeting 'MonoAndroid,Version=v9.0'
Gathering dependency information took 797.15 ms
Attempting to resolve dependencies for package 'SkiaSharp.1.68.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'SkiaSharp.1.68.0'
Resolved actions to install package 'SkiaSharp.1.68.0'

Attempting to gather dependency information for package 'SkiaSharp.1.68.0' with respect to project 'App.iOS', targeting 'Xamarin.iOS,Version=v1.0'
Gathering dependency information took 6.3 ms
Attempting to resolve dependencies for package 'SkiaSharp.1.68.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'SkiaSharp.1.68.0'
Resolved actions to install package 'SkiaSharp.1.68.0'
Package 'SkiaSharp.1.68.0' already exists in folder 'C:\Users\hadri\Source\Repos\App\packages'
Install failed. Rolling back...
Package 'SkiaSharp.1.68.0' does not exist in project 'App.Android'
Removing package 'SkiaSharp.1.68.0' from folder 'C:\Users\hadri\Source\Repos\App\packages'
Removed package 'SkiaSharp.1.68.0' from folder 'C:\Users\hadri\Source\Repos\App\packages'
Executing nuget actions took 1.87 sec
Failed to add reference to 'SkiaSharp'.
  The method or operation is not implemented.
Time Elapsed: 00:00:04.3615380
========== Finished ==========
Happypig375 commented 5 years ago

I successfully worked around this by manually adding to packages.config and manually referencing from the fsproj file. Packages.config:

  <package id="SkiaSharp" version="1.68.0" targetFramework="xamarinios10" />
  <package id="SkiaSharp.Views" version="1.68.0" targetFramework="xamarinios10" />
  <package id="SkiaSharp.Views.Forms" version="1.68.0" targetFramework="xamarinios10" />

fsproj:

    <Reference Include="SkiaSharp">
      <HintPath>..\packages\SkiaSharp.1.68.0\lib\Xamarin.iOS\SkiaSharp.dll</HintPath>
    </Reference>
    <Reference Include="SkiaSharp.Views.Forms">
      <HintPath>..\packages\SkiaSharp.Views.Forms.1.68.0\lib\Xamarin.iOS\SkiaSharp.Views.Forms.dll</HintPath>
    </Reference>
    <Reference Include="SkiaSharp.Views.iOS">
      <HintPath>..\packages\SkiaSharp.Views.1.68.0\lib\Xamarin.iOS\SkiaSharp.Views.iOS.dll</HintPath>
    </Reference>
rrelyea commented 5 years ago

Do we know for sure that the same package version worked in 16.0 and 15.9? Or was it perhaps an earlier package version?

dominoFire commented 5 years ago

It doesn't repro in VS 16.0 (Version 16.0.5 Preview 1.0 [28803.514.d16.0])

Happypig375 commented 5 years ago

As of VS16.1.5, issue only repros on F# Xamarin Android projects. Nope.

xperiandri commented 5 years ago

I had the same issue till VS 2019 16.3 Preview 1 The only workaround was to remove all references to NuGet packages in fsproj and execute Update-Package -project <project name > -reinstall