gpt4 book ai didi

.net - 尝试dotnet还原多项目解决方案时无法解决错误

转载 作者:行者123 更新时间:2023-12-03 14:24:46 26 4
gpt4 key购买 nike

我有一个在本地构建的解决方案,并且创建了一个新构建并向其中添加了一个步骤

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%" ]
}
}


有谁知道为什么这可能是错误的?

最佳答案

您的dependenciesframeworks块对我来说看起来不正确:我希望您依赖的库在dependencies块中声明,而不是在frameworks块中声明。对于一个引用另一个项目的项目,通常更类似于此:

{

"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",
"Wedding.Application": { "target": "project" },
"Wedding.Common": { "target": "project" },
"Wedding.WebApp.Setup": { "target": "project" }
},

"frameworks": {
"net461": {
"imports": []
}
},

...
}

关于.net - 尝试dotnet还原多项目解决方案时无法解决错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39478912/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com