Open sandboxFocus

Method LoadAsync

LoadAsync(params string[])

Asynchronously loads a set of projects or solutions into a Workspace, or returns an existing workspace if the method has been previously called with the exact same parameters.

Declaration
public Task<Workspace> LoadAsync(params string[] paths)
Parameters
Type Name Description
string[] paths

A list of project or solution paths.

Returns
Type Description
Task<Workspace>

A Workspace where all specified projects or solutions, and their dependencies, have been loaded.

See Also
Load(params string[])

LoadAsync(ImmutableArray<string>, ImmutableDictionary<string, string>?, bool, CancellationToken)

Asynchronously loads a set of projects or solutions into a Workspace, or returns an existing workspace if the method has been previously called with the exact same parameters. This overload allows specifying MSBuild properties.

Declaration
public Task<Workspace> LoadAsync(ImmutableArray<string> paths, ImmutableDictionary<string, string>? properties = null, bool restore = true, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ImmutableArray<string> paths

A list of project or solution paths.

ImmutableDictionary<string, string> properties

MSBuild properties to pass to the projects, or null to use default properties.

bool restore

Indicates whether to run dotnet restore before loading projects. The default is true.

CancellationToken cancellationToken

A cancellation token.

Returns
Type Description
Task<Workspace>

A Workspace where all specified projects or solutions, and their dependencies, have been loaded.