我有以下项目结构:
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 reference:everything)
- Proj.WebApi(xproj lib,references:core,services)
我已将项目移至Asp.Net Core,但仍依赖完整的Entity Framework - 版本6.1.3。为实现这一目标,我正在关注this example. 依赖于对Proj.Data的引用的xproj类库在project.json中都具有以下框架属性:
"frameworks": {
"net452": {
"dependencies": {
"Proj.Data": {
"target": "project"
}
}
}
},
但是,当我根据Proj.Data构建项目时,例如Proj.Bootstrapper,我收到以下错误:
错误NU1001无法解析依赖项Proj.Data。
这是Bootstrapper的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-*"
}
而且,值得的是,我的Proj.Data项目中的project.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
</packages>
另外值得一提的是,当编译器抱怨时,我将我的Proj.Data框架从net46降级为net452。
指导赞赏。提前谢谢。
答案 0 :(得分:2)
对我来说问题是因为同时使用.NET Framework和.NET Core。
我缺少.NET Framework 4.6.2。
从https://www.microsoft.com/en-us/download/details.aspx?id=53321安装Microsoft .NET Framework 4.6.2 Developer Pack
后,问题就解决了。
我想在你的情况下你缺少.NET Framework版本4.5.2