我有一个在本地构建的解决方案,我已经创建了一个新构建并向其添加了一个步骤
dotnet restore
我收到此错误消息:
... OTHER SUCCESSFUL INSTALLATIONS ...
log : Installing Microsoft.Extensions.FileProviders.Abstractions 1.0.0.
log : Installing Microsoft.Extensions.Configuration.Abstractions 1.0.0.
log : Installing Microsoft.Extensions.DependencyInjection.Abstractions 1.0.0.
log : Writing lock file to disk. Path: C:\a\1\s\Wedding.WebApp\project.lock.json
log : C:\a\1\s\Wedding.WebApp\project.json
log : Restore failed in 13722ms.
Errors in C:\a\1\s\Wedding.WebApp\project.json
Unable to resolve 'Wedding.Application' for '.NETFramework,Version=v4.6.1'.
Unable to resolve 'Wedding.Common' for '.NETFramework,Version=v4.6.1'.
Unable to resolve 'Wedding.WebApp.Setup' for '.NETFramework,Version=v4.6.1'.
它引用了我的主要Web项目引用的其他三个项目。
这是我的project.json
{
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net461": {
"dependencies": {
"Wedding.Application": {
"target": "project"
},
"Wedding.Common": {
"target": "project"
},
"Wedding.WebApp.Setup": {
"target": "project"
}
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
有谁知道为什么这可能会出错?
答案 0 :(得分:1)
您的dependencies
和frameworks
块看起来不正确:我希望您所依赖的库在dependencies
块内声明,而不是{{ 1}}阻止。对于一个引用另一个项目的项目,它通常更像是这样:
frameworks
答案 1 :(得分:0)
根据this对同一问题的回答:
用.NET Core类库替换项目。它对我有用。
答案 2 :(得分:0)
我有类似的问题。通过手动交换解决方案文件中的项目顺序来解决这个问题。
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Some.Lib", "..\Some\Path\SomeProject.csproj", "{B539B811-6E75-48E0-A679-9F7092CC0261}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Some.Web.App", "SomePath\WebApplication3.csproj", "{244C097B-B6FD-4995-AAE3-87AB1748EA38}"
EndProject
Lib是.NetStandard 1.1和.NetFramework 4.6 Core 1.0上的Web.App。
默认项目订单对我没有用。交换后一切都很好。