How to get “Manage User Secrets” in a .NET Core console-application?

前端 未结 9 1433
醉梦人生
醉梦人生 2020-12-28 12:07

When I create a new ASP .NET Core Web-Application, I can right-click the project in Visual Studio, and I see a context-menu entry called \"Manage User Secre

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-28 12:35

    1.Add to your project file (Prior to dotnet 2.1 only):

    
        
     
    

    2.Set

     
         a random user id: manually add
     
    
    1. Move to the migration project folder in Package Manager Console and add a key:value like:

      dotnet user-secrets set "ConnectionStrings:DefaultConnection" "xxxxx"
      

    Remember to be in the directory of that project (for Package manager console this means cd'ing into the project, not solution level)

提交回复
热议问题