Using user Secrets in the. NET Core Console Application

Source: Internet
Author: User

Microsoft has only Microsoft.NET.Sdk.Web the "Manage User Secrets"/"Manage User Secrets" menu item in the right-click menu of the VS project. There is no such thing in the common console project using MICROSOFT.NET.SDK, so you have to do it yourself.

Ideas

Use the "External tools" of VS to implement scripts to create usersecrets files and open directories for the same functions as "Manage User Secrets" menu items

Realize

Script here

Operation

Save scripts locally, add new tools in VS "Tools-external Tools" (tools–external tools)
Then save it as the following configuration

  • Title: 管理用户机密 (or own name)
  • Command: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (path of Powershell.exe)
  • Parameters: Script path (e.g. D:\VisualStudioTools\usersecrets.ps1 )
  • Initial directory: $(ProjectDir) (VS macro, point to current project directory)

Example:

Use

After adding the tool, select the menu item under the item that requires access/create a user secret to 工具-管理用户机密 open the Secrets.json file

Using user Secrets in the. NET Core Console Application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.