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
コマンドを実行すると、「コマンドが見つかりません」と表示されます。