【发布时间】:2017-08-28 22:16:21
【问题描述】:
在 Visual Studio 2017 中,当我尝试设置用户密码时出现以下错误:
> dotnet user-secrets set Authentication:Google:ClientId mysecretclientid
> Could not find the global property 'UserSecretsId' in MSBuild project 'c:\test\myproj.csproj'. Ensure this property is set in the project or use the '--id' command line option.
我的 Startup.cs 中有这个:
[assembly: UserSecretsId("project-8084c8e7-0000-0000-b266-b33f42dd88c0")]
...
builder.AddUserSecrets<Startup>();
如果我将此添加到我的 csproj:
<PropertyGroup>
<UserSecretsId>project-8084c8e7-0000-0000-b266-b33f42dd88c0</UserSecretsId>
</PropertyGroup>
我收到一个错误提示
Duplicate 'Microsoft.Extensions.Configuration.UserSecrets.UserSecretsIdAttribute'
我做错了什么?
【问题讨论】:
-
这是否意味着您不再需要 UserSecretsId 程序集属性?
-
我发现这个链接更有帮助,配置更少:blogs.msdn.microsoft.com/mihansen/2017/09/10/…
标签: c# asp.net-core .net-core visual-studio-2017