Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
ASP Core Cannot Set User Secrets in VS 2017

With visual studio 2017, when I try to set a user secret I get the following error:

> 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.

I have this in my Startup.cs:

[assembly: UserSecretsId("project-8084c8e7-0000-0000-b266-b33f42dd88c0")]

...

builder.AddUserSecrets<Startup>();

If I add this to my csproj:

  <PropertyGroup>
    <UserSecretsId>project-8084c8e7-0000-0000-b266-b33f42dd88c0</UserSecretsId>
  </PropertyGroup>

I get an error saying

Duplicate 'Microsoft.Extensions.Configuration.UserSecrets.UserSecretsIdAttribute'

What am I doing wrong?

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

In VS Code 2019, you can use the command below to generate the UserSecret section within your csproj file. Please make sure you are within the directory containing the desired csproj file when running the command.

dotnet user-secrets init
about 4 years ago · Santiago Trujillo Report

0

I got the same error and I fixed it by generating a new UserSecretsId.

The UserSecretsId will be generated automatically if you right click on the Project in the Solution Explorer and press Manage User Secrets.

about 4 years ago · Santiago Trujillo Report

0

Ok, so I got it working, looks like in VS 2017 you should remove the "[assembly: UserSecretsId("project-8084c8e7-0000-0000-b266-b33f42dd88c0")]" attribute and have the following in the csproj file:

<PropertyGroup>
    <UserSecretsId>project-8084c8e7-0000-0000-b266-b33f42dd88c0</UserSecretsId>
</PropertyGroup>
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!