gpt4 book ai didi

.net-core - dotnet 核心用户 secret 可执行文件神秘失踪,为什么?

转载 作者:行者123 更新时间:2023-12-04 00:01:40 25 4
gpt4 key购买 nike

安装了最新的(我认为).NET Core,通过 Visual Studio 2015 创建了一个 .NET Core Web 项目,并尝试开始使用用户 secret 。 CLI 声称它丢失了(声称已经安装了它之后......),如下:

E:\Projects\CodeServer>dotnet --version
1.0.0-preview1-002702

E:\Projects\CodeServer>dotnet restore
<snip>
log : Restoring packages for tool 'Microsoft.Extensions.SecretManager.Tools' in E:\Projects\CodeServer\src\CodeServer\project.json...
<snip>
log : Restore completed in 2345ms.

NuGet Config files used:
C:\Users\Work User\AppData\Roaming\NuGet\NuGet.Config
C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

E:\Projects\CodeServer>dotnet user-secrets -h
No executable found matching command "dotnet-user-secrets"

E:\Projects\CodeServer>

还为每个请求添加 project.json 文件:
{
"userSecretsId": "<snip>",

"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Authentication.Google": "1.0.0-rc2-final"
},

"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},

"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},

"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},

"runtimeOptions": {
"gcServer": true
},

"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},

"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

最佳答案

使用 tools 中定义的任何工具包时project.json 文件的一部分,您必须从包含 project.json 文件的同一目录中使用它们。

例如,您的 project.json 文件位于 E:\Projects\CodeServer\src\CodeServer\project.json ,但您正在尝试执行来自 E:\Projects\CodeServer 的命令.如果您更改为 E:\Projects\CodeServer\src\CodeServer\在尝试使用这些工具之前,这些命令将起作用。

关于.net-core - dotnet 核心用户 secret 可执行文件神秘失踪,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37713769/

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