0

I am trying to add the MySQL Data Nuget package to my ASP Web Core project, but I get this error:

One or more packages are incompatible with .NETCoreApp,Version=v1.1 (win-x86).

I am using Visual Studio for Mac. Here's the full error log I get:

Running non-parallel restore.
Reading project file /Users/dk/Documents/HM/Backend/HMBackend/HMBackend/HMBackend.csproj.
Restoring packages for /Users/dk/Documents/HM/Backend/HMBackend/HMBackend/HMBackend.csproj...
Restoring packages for .NETCoreApp,Version=v1.1...
Resolving conflicts for .NETCoreApp,Version=v1.1...
Scanning packages for runtime.json files...
Merging in runtimes defined in package/Microsoft.NETCore.DotNetHostPolicy 1.1.0.
Merging in runtimes defined in package/Microsoft.NETCore.Runtime.CoreCLR 1.1.1.
Merging in runtimes defined in package/Microsoft.NETCore.Platforms 1.1.0.
Merging in runtimes defined in package/Microsoft.NETCore.DotNetHostResolver 1.1.0.
Merging in runtimes defined in package/Microsoft.NETCore.Jit 1.1.1.
Merging in runtimes defined in package/Microsoft.NETCore.Windows.ApiSets 1.0.1.
Merging in runtimes defined in package/Microsoft.NETCore.Targets 1.1.0.
Merging in runtimes defined in package/Microsoft.NETCore.DotNetHost 1.1.0.
Restoring packages for .NETCoreApp,Version=v1.1 (win)...
Resolving conflicts for .NETCoreApp,Version=v1.1 (win)...
Restoring packages for .NETCoreApp,Version=v1.1 (win-x64)...
Resolving conflicts for .NETCoreApp,Version=v1.1 (win-x64)...
Restoring packages for .NETCoreApp,Version=v1.1 (win-x86)...
Resolving conflicts for .NETCoreApp,Version=v1.1 (win-x86)...
Checking compatibility of packages on .NETCoreApp,Version=v1.1.
Checking compatibility for HMBackend 1.0.0 with .NETCoreApp,Version=v1.1.
Checking compatibility for MySql.Data 6.9.9 with .NETCoreApp,Version=v1.1.
Package MySql.Data 6.9.9 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package MySql.Data 6.9.9 supports:
  - net40 (.NETFramework,Version=v4.0)
  - net45 (.NETFramework,Version=v4.5)
Checking compatibility for System.Diagnostics.FileVersionInfo 4.0.0 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for System.Xml.XPath.XDocument 4.0.1 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for runtime.any.System.Reflection.Extensions 4.3.0 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for runtime.any.System.Reflection.Primitives 4.3.0 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for Microsoft.NETCore.DotNetHost 1.1.0 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for runtime.win.System.Console 4.3.0 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for runtime.any.System.Diagnostics.Tools 4.3.0 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for Microsoft.AspNetCore.Cryptography.Internal 1.1.2 with .NETCoreApp,Version=v1.1 (win-x86).
Checking compatibility for Microsoft.AspNetCore.DataProtection.Abstractions 1.1.2 with .NETCoreApp,Version=v1.1 (win-x86).
One or more packages are incompatible with .NETCoreApp,Version=v1.1 (win-x86).
Incompatible packages: 1
Package restore failed. Rolling back package changes for 'HMBackend'.

Here's what my .csproj looks like:

<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
    <PropertyGroup>
        <TargetFramework>netcoreapp1.1</TargetFramework>
    </PropertyGroup>
    <ItemGroup>
        <Folder Include="wwwroot\" />
        <Folder Include="DAO\" />
        <Folder Include="Model\" />
        <Folder Include="Helpers\" />
    </ItemGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
        <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
        <PackageReference Include="System.Data.SqlClient" Version="4.3.1" />
        <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
        <PackageReference Include="System.Net.Http" Version="4.3.2" />
        <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="1.2.0" />
    </ItemGroup>
    <ItemGroup>
        <Compile Remove="Model\ResponseCallBack.cs" />
    </ItemGroup>
</Project>

How can I resolve this error?

1 Answer 1

1

From the NuGet output:

Package MySql.Data 6.9.9 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package MySql.Data 6.9.9 supports: - net40 (.NETFramework,Version=v4.0) - net45 (.NETFramework,Version=v4.5)

The MySql.Data NuGet package contains assemblies for .NET 4.0 and 4.5. You cannot use these in a .NET Core 1.1 project.

Options:

  1. Find another MySql NuGet package or library that supports .NET Standard, PCL or .NET Core. There is the MySqlConnector for example.
  2. Change your project to target .NET Core 2.0.
    • The MySql.Data NuGet package would need to be tested to see if it is compatible with .NET Core 2.0. Whilst you can use NuGet packages that target .NET from a .NET Core 2.0 project that does not guarantee the assembly will work, since it may be using some API not supported by .NET Core 2.0.
Sign up to request clarification or add additional context in comments.

1 Comment

The MySqlConnector Nuget worked as a great alternative! Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.