无法解析依赖项MySql.Data> = 7.0.6-ir31

时间:2017-02-10 17:39:20

标签: mysql ubuntu nginx asp.net-core

我尝试将我的asp.net核心web api部署到nginx,web api项目引用了一个类库。类库从nuget安装了MySql.Data包。将整个项目复制到ubuntu并执行“dotnet restore”命令后,这一步都很顺利。但是当我执行'dotnet publish'命令时,我收到了一个错误:

为.NETStandard编译App.DAL.Core,版本= v1.6 /home/.../project.json:错误NU1001:无法解析依赖项MySql.Data&gt; = 7.0.6-ir31 < / p>

我查了一下这个帖子,

MySQL -> .NET Core Dependency error (MySql.Data)

将IR更改为ir,但仍无效。请参阅我的project.json文件

DAL.Core Porject.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "MySql.Data": "7.0.6-ir31",
    "NETStandard.Library": "1.6.0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

Web API Project.json

{
  "dependencies": {
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "log4net": "2.0.7",
    "Newtonsoft.Json": "9.0.1",
    "App.DAL.Core": "1.0.0-*",
    "MySql.Data": "7.0.6-ir31",
    "Microsoft.AspNetCore.Mvc.WebApiCompatShim": "1.0.0",
    "System.Net.Http": "4.1.0",
    "System.Text.Encoding": "4.3.0",
    "Microsoft.AspNetCore.Mvc.Core": "1.0.0",
    "System.Net.Requests": "4.0.11",
    "Microsoft.NETCore.App": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },

  "runtimes": {
    "ubuntu.14.04-x64": {}
  }
}

任何人都可以提供帮助吗?

1 个答案:

答案 0 :(得分:0)

将以下代码添加到DAL.Core项目的project.json文件中解决问题

&#13;
&#13;
"runtimes": {
    "ubuntu.14.04-x64": {}
  }
&#13;
&#13;
&#13;