简体   繁体   English

.NET 与 MySql.Data 的兼容性

[英].NET compatibility with MySql.Data

I've setup an asp.net webapi project in VS Code (cmd: dotnet new webapi).我已经在 VS Code 中设置了一个 asp.net webapi 项目(cmd:dotnet new webapi)。 I've installed Nuget and loaded MySql.Data, Version="6.9.9" in my project.我已经在我的项目中安装了 Nuget 并加载了 MySql.Data, Version="6.9.9"。 After restoring the project (cmd: dotnet restore) I get following error:恢复项目(cmd:dotnet restore)后,我收到以下错误:

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

Here is my .csproj-File:这是我的 .csproj 文件:

<?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...提前致谢...

By following this introduction: How to change target framework with VS 2017 RC?通过以下介绍: 如何使用 VS 2017 RC 更改目标框架? I solved the issue.我解决了这个问题。

My csproj-File now looks like this:我的 csproj-File 现在看起来像这样:

<?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!恢复项目(cmd:dotnet restore)效果很好!

As I recall, all pre-releases worked with .net core.我记得,所有预发布版本都使用 .net core。 Unfortunately when I had tried all versions up to 6.9.9 it didn't work.不幸的是,当我尝试了 6.9.9 之前的所有版本时,它不起作用。 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.然而,当我使用核心 1.1 时,我使用了预发布版本 7.x。 This version was removed recently.这个版本最近被删除了。 But I am quite sure 8.0.8-dmr will work.但我很确定 8.0.8-dmr 会工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM