Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithBrowserLogs

Method
📦 Aspire.Hosting.Browsers v17.0.0-preview.1.26565.2
func (ResourceWithEndpoints) WithBrowserLogs(options ...*WithBrowserLogsOptions) ResourceWithEndpoints

Signature

methodWithBrowserLogsbuilder
Adds a child resource that can open the application's primary browser endpoint in a tracked browser session, surface browser diagnostics, and capture screenshots.
WithBrowserLogs(options ...*WithBrowserLogsOptions) ResourceWithEndpoints
options...*WithBrowserLogsOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithBrowserLogsOptions argument.

Browser*stringThe browser to launch. When not specified, the tracked browser uses the configured value from Aspire:Hosting:BrowserLogs and otherwise prefers an installed "msedge" browser in shared user data mode, an installed "chrome" browser in isolated user data mode, and finally falls back to "chrome". Supported values include logical browser names such as "msedge" and "chrome", or an explicit browser executable path.
Profile*stringOptional Chromium profile name or directory name to use. Only valid when the effective user data mode is Shared. When not specified, the tracked browser uses the configured value from Aspire:Hosting:BrowserLogs if present.
UserDataMode*BrowserUserDataModeOptional BrowserUserDataMode that selects whether the tracked browser launches against a persistent Aspire-managed user data directory shared across all AppHosts on the machine (Shared, the default) or a per-AppHost persistent user data directory (Isolated). Both modes use Aspire-managed paths under %LocalAppData%\Aspire\BrowserData on Windows (or platform equivalents); the user's normal browser profile is never used. When not specified, the tracked browser uses the configured value from Aspire:Hosting:BrowserLogs and otherwise defaults to Shared.
ResourceWithEndpoints

The resource builder.

Returns a handle; failures surface later via Err().

Applies to

This method applies to the following types:

typeCSharpAppResource
typeContainerResource
typeDotnetToolResource
typeExecutableResource
typeProjectResource