我有以下項目結構:「依賴無法解析」爲核心Asp.Net引用凸出6.1.3的EntityFramework凸出
Proj.sln
- Proj.Core (xproj lib, references: nothing)
- Proj.Services (xproj lib, referencs: core, data)
- Proj.Data (csproj lib, references: core)
- Proj.Bootstrapper (xproj lib references: everything)
- Proj.WebApi (xproj lib, references: core, services)
我提出項目Asp.Net核心,但仍然依賴在完整的實體框架 - 版本6.1.3。要做到這一點,我下面this example. 依賴於Proj.Data參考的xproj類庫,都在project.json以下框架屬性:
"frameworks": {
"net452": {
"dependencies": {
"Proj.Data": {
"target": "project"
}
}
}
},
然而,當我建立這取決於項目Proj.Data,例如Proj.Bootstrapper,我收到以下錯誤:
錯誤NU1001依賴項Proj.Data無法解析。
這裏是引導程序的project.json:
{
"buildOptions": {
"emitEntryPoint": false,
"xmlDoc": false
},
"dependencies": {
"EntityFramework": "6.1.3",
"Autofac.Extensions.DependencyInjection": "4.0.0",
"Newtonsoft.Json": "9.0.1",
"Proj.Core": "1.0.0-*",
"Proj.Services": "1.0.0-*",
"Proj.WebApi": "1.0.0-*",
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
"Microsoft.AspNetCore.DataProtection.Extensions": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Identity": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Extensions.Configuration": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"System.IdentityModel.Tokens.Jwt": "5.1.0"
},
"frameworks": {
"net452": {
"dependencies": {
"Proj.Data": {
"target": "project"
}
}
}
},
"version": "1.0.0-*"
}
而且,對於什麼是值得,我project.config在我Proj.Data項目:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
</packages>
另外值得一提的是,當編譯器抱怨時,我將我的Proj.Data框架從net46降級到net452。
引導讚賞。提前致謝。
我不認爲你(現在)可以從'csproj'參考'xproj',因爲你是在做Proj.Data 。另外,當使用'dotnet restore'恢復時,你還會得到NuGet錯誤嗎? –
謝謝,Nate。實際上,我之前可以從Data中引用Core。但是,作爲一項測試,我把它拿出來了,但它仍然破裂。是的,如果我從Bootstrapper運行dotnet恢復,它會拋出我上面提到的錯誤。就我個人而言,我認爲這個問題與這裏提到的框架版本控制有關。 http://www.hanselman.com/blog/HowToReferenceAnExistingNETFrameworkProjectInAnASPNETCore10WebApp.aspx –