Partager via


IVsProjectSecrets.SetSecretAsync(String, String, CancellationToken) Method

Definition

Adds or updates a secret with the given name so the application built by this project can access it at runtime.

public System.Threading.Tasks.Task SetSecretAsync (string name, string value, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.Task SetSecretAsync (string name, string? value, System.Threading.CancellationToken cancellationToken = default);
abstract member SetSecretAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SetSecretAsync (name As String, value As String, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

name
String

The name of the secret. Must not be null or empty.

value
String

The secret itself.

cancellationToken
CancellationToken

A token that may cancel this operation.

Returns

A task that represents the asynchronous store operation.

Exceptions

Thrown if name is null.

Thrown if name is empty or contains reserved characters that GetInvalidCharactersFrom(String) would have indicated were disallowed.

Thrown when integrity rules would be violated by this operation.

Thrown when the user does not have permission for this operation.

Thrown when the operation could not be completed due to some network or I/O failure.

Applies to