H. Senkaya
H. Senkaya

Reputation: 773

.NET compatibility with MySql.Data

I've setup an asp.net webapi project in VS Code (cmd: dotnet new webapi). I've installed Nuget and loaded MySql.Data, Version="6.9.9" in my project. After restoring the project (cmd: dotnet restore) I get following error:

error NU1202: Package MySql.Data 6.9.9 is not compatible with netcoreapp1.1 (.NETCoreApp, Version=v1.1)

Here is my .csproj-File:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="wwwroot\"/>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2"/>
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3"/>
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1"/>
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2"/>
    <PackageReference Include="MySql.Data" Version="6.9.9"/>
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1"/>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0"/>
  </ItemGroup>
</Project>

Anybody knows which versions are compatible together? Thanks in advance...

Upvotes: 1

Views: 934

Answers (2)

Neville Nazerane
Neville Nazerane

Reputation: 7019

As I recall, all pre-releases worked with .net core. Unfortunately when I had tried all versions up to 6.9.9 it didn't work. I have been using the pre-releases for a while now and found no issues. When I was using core 1.1 however, I used the pre-release version 7.x. This version was removed recently. But I am quite sure 8.0.8-dmr will work.

Upvotes: 0

H. Senkaya
H. Senkaya

Reputation: 773

By following this introduction: How to change target framework with VS 2017 RC? I solved the issue.

My csproj-File now looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
    <RuntimeIdentifier>win7-x86</RuntimeIdentifier>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="wwwroot\"/>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2"/>
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3"/>
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1"/>
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2"/>
    <PackageReference Include="MySql.Data" Version="6.9.9"/>
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1"/>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0"/>
  </ItemGroup>
</Project>

Restoring project (cmd: dotnet restore) works well!

Upvotes: 1

Related Questions