2017-02-10 67 views
0

我試圖將我的asp.net核心web api部署到nginx,web api項目引用了一個類庫。類庫安裝了來自nuget的MySql.Data包。在將整個項目複製到ubuntu並執行「dotnet restore」命令後,在這一步中都可以正常運行。但是當我執行'dotnet publish'命令時,我得到一個錯誤:依賴項MySql.Data> = 7.0.6-ir31無法解析

爲.NETStandard編譯App.DAL.Core版本= v1.6 /home/.../project.json錯誤NU1001:依賴關係MySql.Data> = 7.0.6-IR31無法解析

我檢查這個線程,

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

改變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": {} 
    } 
} 

任何人都可以幫助嗎?

+0

你改變它在這兩個地方的問題?你可以在你的類庫和你的應用程序中參考 – Tseng

+0

當然,兩個project.json文件被改變 – Allen4Tech

+0

另外,我可以看到兩個project.lock.json文件已經從IR31更改爲ir31 – Allen4Tech

回答

0

添加如下代碼即可DAL.Core項目的project.json文件解決

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

相關問題