如何在Mac OSX中安装DNX Secret Manager

时间:2015-05-23 01:20:06

标签: macos asp.net-core dnx

我正在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命令时,我得到'命令未找到'。

1 个答案:

答案 0 :(得分:2)

很抱歉,这是一个已知问题,我们已经修复了beta5。

您有两种选择:

  1. 传递后备来源:dnu commands install secretmanager 1.0.0-beta4 -f https://www.myget.org/F/aspnetrelease/api/v2
  2. 更新到最新的beta5位