# SubscribeBeforeStart

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`DistributedApplicationBuilder`](/reference/api/go/aspire.hosting/distributedapplicationbuilder.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Subscribes to the BeforeStart event, which fires before the application starts.

## Remarks

This event provides access to the service provider and distributed application model,
allowing you to perform final configuration or validation before resources start.

## Definition

```go
func (DistributedApplicationBuilder) SubscribeBeforeStart(callback func(arg BeforeStartEvent)) DistributedApplicationEventSubscription
```

## Parameters

- `callback` (`func(arg BeforeStartEvent)`) -- A callback that receives the exported event when the event fires.

## Returns

[`DistributedApplicationEventSubscription`](/reference/api/go/aspire.hosting/distributedapplicationeventsubscription.md) -- A subscription handle that can be used to unsubscribe.

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

## Applies to

- [`DistributedApplicationBuilder`](/reference/api/go/aspire.hosting/distributedapplicationbuilder.md)
