我在 Mac OS X 上使用 ASP.NET5 进行开发。我想实现 OAuth 并使用 Secret Manager 来存储我的秘密配置,所以我正在关注这个 DNXSecret 配置页面。 https://github.com/aspnet/Home/wiki/DNX-Secret-Configuration
但是,按照说明操作后,我无法成功地将user-secret
命令安装到我的 Mac 上,而且我几乎被卡住了。
作为第一步,我安装了 DNVM 并确认dnvm list
命令返回 Mono 作为运行时引擎。
$ dnvm list
Active Version Runtime Arch Location Alias
------ ------- ------- ---- -------- -----
* 1.0.0-beta4 mono ~/.dnx/runtimes default
我还安装了 Yeoman、Grunt、Bower 等,并且dnu restore
命令运行良好。我成功地在本地和 Azure 上展示了一个 Yeoman 搭建的 ASP.NET5 页面。
然后我开始按照上面的页面安装 Secret Manager。一开始,以下命令失败:
dnu commands install SecretManager
出现以下错误:
Errors in /Users/<username>/.dnx/bin/packages/SecretManager/1.0.0-beta4/app/project.json
Unable to locate SecretManager >= 1.0.0-beta4-10173
因此,我将上面的“project.json”文件在其“依赖项”块中修改为:
{
"version": "1.0.0-*",
"description": "ASP.NET 5 tool to manage user secrets.",
"dependencies": {
"SecretManager": "1.0.0-beta4" // <<- modified here
//"SecretManager": "1.0.0-beta4-10173"
},
"commands": {
"user-secret": "SecretManager"
},
"userSecretsId": "testuserSecretsId",
"frameworks": {
"dnx451": {},
"dnxcore50": {
"dependencies": {
"System.Console": "4.0.0-beta-*"
}
}
},
"entryPoint": "SecretManager",
"loadable": false
}
(之前)“SecretManager”:“1.0.0-beta4-10173”
(之后)“SecretManager”:“1.0.0-beta4”
然后命令成功完成,SecretManager 似乎已安装,结果如下:
konishis-air:AspNetSocialLoginTest Ryuji$ dnu commands install SecretManager
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='SecretManager'.
OK https://www.nuget.org/api/v2/FindPackagesById()?Id='SecretManager' 1674ms
Restoring packages for /Users/Ryuji/.dnx/bin/packages/e27d166dcf594105be47fff78420df10/project.json
Writing lock file /Users/Ryuji/.dnx/bin/packages/e27d166dcf594105be47fff78420df10/project.lock.json
Restore complete, 246ms elapsed
Restoring packages for /Users/Ryuji/.dnx/bin/packages/SecretManager/1.0.0-beta4/app/project.json
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console'.
OK https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console' 1395ms
Writing lock file /Users/Ryuji/.dnx/bin/packages/SecretManager/1.0.0-beta4/app/project.lock.json
Restore complete, 1751ms elapsed
The following commands were installed: .project.json, user-secret
但是,当我运行user-secret
命令时,我得到“找不到命令”。