CommunityToolkit.Aspire.Hosting.Golang 13.0.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.Hosting.Golang --version 13.0.0
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Golang -Version 13.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Golang" Version="13.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Golang" Version="13.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Golang" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.Hosting.Golang --version 13.0.0
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Golang, 13.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package [email protected]
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Golang&version=13.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Golang&version=13.0.0
                    
Install as a Cake Tool

CommunityToolkit.Aspire.Hosting.Golang library

Provides extensions methods and resource definitions for the .NET Aspire AppHost to support running Golang applications.

Getting Started

Install the package

In your AppHost project, install the package using the following command:

dotnet add package CommunityToolkit.Aspire.Hosting.Golang

Example usage

Then, in the Program.cs file of AppHost, define a Golang resource, then call AddGolangApp:

var golang = builder.AddGolangApp("golang", "../gin-api")
    .WithHttpEndpoint(env: "PORT");

The PORT environment variable is used to determine the port the Golang application should listen on. It is randomly assigned by the .NET Aspire. The name of the environment variable can be changed by passing a different value to the WithHttpEndpoint method.

To have the Golang application listen on the correct port, you can use the following code in your Golang application:

r.Run(":"+os.Getenv("PORT"))

Publishing

When publishing your Aspire application, the Golang resource automatically generates a multi-stage Dockerfile for containerization. This means you don't need to manually create a Dockerfile for your Golang application.

Automatic Version Detection

The integration automatically detects the Go version to use by:

  1. Checking the go.mod file for the Go version directive
  2. Falling back to the installed Go toolchain version
  3. Using Go 1.23 as the default if no version is detected

Customizing Base Images

You can customize the base images used in the Dockerfile:

var golang = builder.AddGolangApp("golang", "../gin-api")
    .WithHttpEndpoint(env: "PORT")
    .WithDockerfileBaseImage(
        buildImage: "golang:1.22-alpine",
        runtimeImage: "alpine:3.20");

Generated Dockerfile

The automatically generated Dockerfile:

  • Uses the detected or default Go version (e.g., golang:1.22) as the build stage
  • Uses alpine:3.21 as the runtime stage for a smaller final image
  • Installs CA certificates in the runtime image for HTTPS support
  • Respects your build tags if specified
  • Builds the executable specified in your AddGolangApp call

This automatic Dockerfile generation happens when you publish your Aspire application and requires no additional configuration.

Additional Information

https://learn.microsoft.com/dotnet/aspire/community-toolkit/hosting-golang

Feedback & contributing

https://github.com/CommunityToolkit/Aspire

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.0.1-beta.486 38 1/12/2026
13.0.1-beta.468 649 12/3/2025
13.0.1-beta.467 622 12/3/2025
13.0.0 1,123 11/25/2025
13.0.0-beta.462 138 11/25/2025
13.0.0-beta.456 143 11/23/2025
13.0.0-beta.454 89 11/23/2025
13.0.0-beta.453 114 11/22/2025
13.0.0-beta.450 124 11/22/2025
13.0.0-beta.448 119 11/22/2025
13.0.0-beta.444 495 11/17/2025
13.0.0-beta.443 411 11/17/2025
13.0.0-beta.440 102 11/15/2025
13.0.0-beta.439 245 11/12/2025
13.0.0-beta.438 228 11/12/2025
13.0.0-beta.436 233 11/12/2025
13.0.0-beta.435 246 11/11/2025
13.0.0-beta.433 163 11/10/2025
13.0.0-beta.432 157 11/10/2025
13.0.0-beta.431 146 11/6/2025
13.0.0-beta.430 147 11/6/2025
9.9.0 307 11/3/2025
9.9.0-beta.427 155 11/3/2025
9.8.1-beta.426 154 11/3/2025
9.8.1-beta.424 147 10/28/2025
9.8.1-beta.420 139 10/27/2025
9.8.1-beta.419 135 10/27/2025
9.8.1-beta.417 143 10/27/2025
9.8.1-beta.414 138 10/24/2025
9.8.1-beta.413 142 10/22/2025
9.8.1-beta.410 134 10/16/2025
9.8.1-beta.408 120 10/16/2025
9.8.1-beta.407 126 10/16/2025
9.8.1-beta.406 136 10/15/2025
9.8.0 1,205 9/26/2025
9.8.0-beta.405 130 10/15/2025
9.8.0-beta.404 138 10/13/2025
9.8.0-beta.402 140 9/29/2025
9.8.0-beta.401 139 9/29/2025
9.8.0-beta.399 138 9/26/2025
9.8.0-beta.398 135 9/25/2025
9.8.0-beta.397 150 9/25/2025
9.8.0-beta.395 137 9/24/2025
9.8.0-beta.394 141 9/23/2025
9.8.0-beta.393 141 9/23/2025
9.8.0-beta.392 148 9/23/2025
9.8.0-beta.389 270 9/18/2025
9.8.0-beta.388 278 9/16/2025
9.8.0-beta.386 215 9/15/2025
9.8.0-beta.385 217 9/15/2025
9.8.0-beta.384 65 9/13/2025
9.8.0-beta.376 143 9/8/2025
9.8.0-beta.375 75 9/6/2025
9.8.0-beta.373 150 9/5/2025
9.8.0-beta.372 156 9/4/2025
9.8.0-beta.370 143 9/2/2025
9.8.0-beta.364 143 9/1/2025
9.7.2 7,219 8/29/2025
9.7.2-beta.362 191 8/29/2025
9.7.2-beta.361 185 8/29/2025
9.7.2-beta.360 190 8/29/2025
9.7.2-beta.359 179 8/28/2025
9.7.2-beta.358 182 8/28/2025
9.7.2-beta.357 188 8/28/2025
9.7.1 241 8/27/2025
9.7.1-beta.355 190 8/27/2025
9.7.1-beta.354 185 8/27/2025
9.7.1-beta.353 184 8/27/2025
9.7.1-beta.352 181 8/27/2025
9.7.1-beta.351 189 8/27/2025
9.7.1-beta.348 158 8/14/2025
9.7.1-beta.344 262 8/10/2025
9.7.1-beta.343 256 8/8/2025
9.7.1-beta.342 223 8/7/2025
9.7.1-beta.341 228 8/6/2025
9.7.1-beta.340 207 8/5/2025
9.7.1-beta.339 213 8/5/2025
9.7.0 226 8/1/2025
9.7.0-beta.337 101 8/1/2025
9.7.0-beta.336 108 8/1/2025
9.7.0-beta.335 106 8/1/2025
9.7.0-beta.333 118 7/30/2025
9.6.1-beta.332 121 7/30/2025
9.6.1-beta.331 122 7/30/2025
9.6.1-beta.330 112 7/30/2025
9.6.1-beta.329 119 7/30/2025
9.6.1-beta.328 132 7/29/2025
9.6.1-beta.327 135 7/28/2025
9.6.1-beta.326 139 7/28/2025
9.6.0 212 7/10/2025
9.6.0-beta.324 147 7/10/2025
9.5.1-beta.323 140 7/10/2025
9.5.1-beta.322 153 7/10/2025
9.5.1-beta.321 151 7/10/2025
9.5.1-beta.320 141 7/9/2025
9.5.1-beta.319 140 7/8/2025
9.5.1-beta.318 144 7/2/2025
9.5.1-beta.317 140 6/30/2025
9.5.1-beta.315 142 6/26/2025
9.5.1-beta.314 141 6/23/2025
9.5.1-beta.313 146 6/20/2025
9.5.1-beta.312 158 6/20/2025
9.5.1-beta.311 173 6/18/2025
9.5.1-beta.310 168 6/17/2025
9.5.1-beta.309 162 6/17/2025
9.5.1-beta.308 154 6/17/2025
9.5.1-beta.307 248 6/16/2025
9.5.1-beta.306 308 6/11/2025
9.5.1-beta.305 142 6/7/2025
9.5.1-beta.304 152 6/6/2025
9.5.1-beta.303 140 6/4/2025
9.5.1-beta.302 158 6/4/2025
9.5.1-beta.301 177 6/2/2025
9.5.1-beta.300 174 5/28/2025
9.5.0 403 5/27/2025
9.5.0-beta.299 166 5/27/2025
9.5.0-beta.298 147 5/26/2025
9.5.0-beta.297 126 5/24/2025
9.5.0-beta.296 119 5/24/2025
9.5.0-beta.295 95 5/24/2025
9.4.1-beta.291 154 5/19/2025
9.4.1-beta.289 165 5/16/2025
9.4.1-beta.288 243 5/16/2025
9.4.1-beta.287 221 5/16/2025
9.4.1-beta.286 213 5/16/2025
9.4.1-beta.285 233 5/14/2025
9.4.1-beta.284 252 5/13/2025
9.4.1-beta.283 247 5/12/2025
9.4.1-beta.282 162 5/7/2025
9.4.1-beta.280 171 5/2/2025
9.4.1-beta.279 169 5/2/2025
9.4.1-beta.277 171 4/23/2025
9.4.1-beta.276 163 4/23/2025
9.4.1-beta.275 179 4/23/2025
9.4.1-beta.274 169 4/23/2025
9.4.1-beta.273 183 4/23/2025
9.4.1-beta.272 175 4/23/2025
9.4.1-beta.271 175 4/23/2025
9.4.1-beta.270 196 4/20/2025
9.4.0 240 4/20/2025
9.4.0-beta.269 194 4/20/2025
9.4.0-beta.268 188 4/20/2025
9.3.1-beta.267 170 4/20/2025
9.3.1-beta.266 103 4/19/2025
9.3.1-beta.265 215 4/15/2025
9.3.1-beta.264 206 4/15/2025
9.3.1-beta.263 203 4/15/2025
9.3.1-beta.262 195 4/15/2025
9.3.1-beta.260 164 4/10/2025
9.3.1-beta.259 180 4/8/2025
9.3.1-beta.258 176 4/8/2025
9.3.1-beta.257 183 4/8/2025
9.3.1-beta.256 179 4/8/2025
9.3.1-beta.255 174 4/8/2025
9.3.1-beta.254 175 4/8/2025
9.3.1-beta.253 182 4/1/2025
9.3.1-beta.252 144 3/27/2025
9.3.1-beta.250 169 3/27/2025
9.3.1-beta.249 172 3/27/2025
9.3.1-beta.248 156 3/27/2025
9.3.1-beta.247 175 3/27/2025
9.3.1-beta.244 505 3/25/2025
9.3.1-beta.242 499 3/24/2025
9.3.1-beta.241 188 3/19/2025
9.3.0 261 3/19/2025
9.3.0-beta.239 174 3/19/2025
9.2.2-beta.237 178 3/19/2025
9.2.2-beta.236 153 3/14/2025
9.2.2-beta.230 148 3/13/2025
9.2.2-beta.229 179 3/13/2025
9.2.2-beta.228 185 3/11/2025
9.2.2-beta.227 182 3/11/2025
9.2.2-beta.226 185 3/11/2025
9.2.2-beta.225 157 3/11/2025
9.2.2-beta.224 186 3/11/2025
9.2.2-beta.223 160 3/10/2025
9.2.2-beta.222 201 3/10/2025
9.2.2-beta.220 190 3/9/2025
9.2.2-beta.218 208 3/9/2025
9.2.2-beta.217 228 3/7/2025
9.2.2-beta.216 201 3/7/2025
9.2.2-beta.215 219 3/7/2025
9.2.2-beta.214 209 3/5/2025
9.2.2-beta.213 211 3/5/2025
9.2.2-beta.212 230 3/5/2025
9.2.2-beta.211 235 3/4/2025
9.2.2-beta.210 227 3/4/2025
9.2.2-beta.208 112 3/3/2025
9.2.1 201 3/3/2025
9.2.1-beta.207 141 3/2/2025
9.2.1-beta.206 94 3/1/2025
9.2.1-beta.205 121 2/27/2025
9.2.1-beta.204 95 2/26/2025
9.2.1-beta.203 88 2/26/2025
9.2.0 417 2/26/2025
9.2.0-beta.202 112 2/26/2025
9.2.0-beta.201 124 2/26/2025
9.2.0-beta.199 122 2/26/2025
9.2.0-beta.198 98 2/26/2025
9.1.1-beta.197 103 2/25/2025
9.1.1-beta.196 119 2/25/2025
9.1.1-beta.195 92 2/25/2025
9.1.1-beta.194 102 2/25/2025
9.1.1-beta.193 123 2/25/2025
9.1.1-beta.192 117 2/24/2025
9.1.1-beta.191 114 2/24/2025
9.1.1-beta.190 124 2/19/2025
9.1.1-beta.189 95 2/19/2025
9.1.1-beta.188 130 2/19/2025
9.1.1-beta.187 128 2/19/2025
9.1.1-beta.183 130 2/18/2025
9.1.1-beta.182 132 2/18/2025
9.1.1-beta.181 146 2/18/2025
9.1.1-beta.180 114 2/17/2025
9.1.1-beta.178 132 2/17/2025
9.1.1-beta.177 137 2/12/2025
9.1.1-beta.176 124 2/11/2025
9.1.1-beta.175 107 2/11/2025
9.1.1-beta.173 132 2/10/2025
9.1.1-beta.169 107 2/6/2025
9.1.1-beta.168 112 2/5/2025
9.1.1-beta.166 94 2/5/2025
9.1.1-beta.165 115 2/5/2025
9.1.1-beta.164 118 2/3/2025
9.1.1-beta.162 106 2/3/2025
9.1.1-beta.155 112 1/30/2025
9.1.1-beta.154 86 1/30/2025
9.1.1-beta.153 109 1/30/2025
9.1.1-beta.152 88 1/29/2025
9.1.1-beta.150 125 1/29/2025
9.1.1-beta.148 106 1/26/2025
9.1.1-beta.147 114 1/26/2025
9.1.1-beta.146 117 1/23/2025
9.1.1-beta.145 104 1/22/2025
9.1.1-beta.144 112 1/22/2025
9.1.1-beta.142 88 1/22/2025
9.1.1-beta.140 121 1/22/2025
9.1.1-beta.139 113 1/21/2025
9.1.1-beta.138 109 1/20/2025
9.1.1-beta.137 81 1/17/2025
9.1.1-beta.136 102 1/15/2025
9.1.1-beta.135 63 1/15/2025
9.1.1-beta.134 80 1/15/2025
9.1.1-beta.128 106 1/9/2025
9.1.1-beta.127 94 1/9/2025
9.1.1-beta.126 106 1/9/2025
9.1.1-beta.125 109 1/9/2025
9.1.1-beta.124 113 1/9/2025
9.1.0 2,463 12/12/2024
9.1.0-beta.123 122 1/3/2025
9.1.0-beta.122 102 1/3/2025
9.1.0-beta.121 124 1/2/2025
9.1.0-beta.120 112 12/30/2024
9.1.0-beta.119 115 12/30/2024
9.1.0-beta.118 101 12/30/2024
9.1.0-beta.116 101 12/30/2024
9.1.0-beta.114 104 12/30/2024
9.1.0-beta.113 127 12/30/2024
9.1.0-beta.112 121 12/18/2024
9.1.0-beta.110 133 12/16/2024
9.1.0-beta.109 127 12/12/2024
9.0.1-beta.108 108 12/12/2024
9.0.1-beta.107 109 12/11/2024
9.0.1-beta.106 103 12/12/2024
9.0.1-beta.104 115 12/11/2024
9.0.1-beta.102 93 12/6/2024
9.0.1-beta.99 120 12/6/2024
9.0.1-beta.98 96 12/6/2024
9.0.1-beta.95 94 12/5/2024
9.0.1-beta.94 117 12/5/2024
9.0.1-beta.93 110 12/2/2024
9.0.1-beta.92 118 11/30/2024
9.0.1-beta.91 114 11/30/2024
9.0.1-beta.90 126 11/29/2024
9.0.1-beta.89 125 11/29/2024
9.0.1-beta.88 107 11/27/2024
9.0.1-beta.87 113 11/27/2024
9.0.1-beta.86 124 11/27/2024
9.0.1-beta.84 118 11/24/2024
9.0.1-beta.83 117 11/22/2024
9.0.1-beta.82 136 11/21/2024
9.0.1-beta.81 110 11/19/2024
9.0.1-beta.80 84 11/19/2024
9.0.1-beta.79 113 11/19/2024
9.0.1-beta.77 126 11/15/2024
9.0.0 233 11/15/2024
9.0.0-beta.76 122 11/14/2024
9.0.0-beta.75 112 11/14/2024
9.0.0-beta.74 100 11/14/2024
9.0.0-beta.73 98 11/14/2024
9.0.0-beta.72 115 11/14/2024
9.0.0-beta.71 117 11/13/2024
9.0.0-beta.70 121 11/13/2024
9.0.0-beta.69 120 11/13/2024
9.0.0-beta.68 122 11/13/2024
9.0.0-beta.67 124 11/13/2024
9.0.0-beta.66 92 11/13/2024
9.0.0-beta.63 119 11/12/2024
9.0.0-beta.54 113 10/31/2024
9.0.0-beta.53 98 10/29/2024
8.3.0 205 10/29/2024
8.3.0-beta.51 119 10/29/2024
8.3.0-beta.50 97 10/28/2024
8.3.0-beta.49 126 10/28/2024
8.3.0-beta.48 85 10/28/2024
8.3.0-beta.47 127 10/28/2024
8.3.0-beta.46 115 10/27/2024
8.3.0-beta.45 124 10/25/2024
8.3.0-beta.44 127 10/25/2024
8.3.0-beta.43 119 10/25/2024
8.3.0-beta.42 123 10/24/2024
8.2.1 200 10/23/2024
8.2.1-beta.40 87 10/23/2024
8.2.1-beta.39 94 10/23/2024
8.2.1-beta.38 128 10/23/2024
8.2.1-beta.37 119 10/23/2024
8.2.1-beta.36 126 10/23/2024
8.2.1-beta.35 119 10/23/2024
8.2.0-beta.34 102 10/23/2024
8.2.0-beta.33 115 10/23/2024
8.2.0-beta.32 120 10/22/2024
1.0.0-beta.60 128 11/11/2024
1.0.0-beta.58 118 11/4/2024
1.0.0-beta.57 100 11/1/2024
1.0.0-beta.56 123 11/1/2024
1.0.0-beta.55 122 11/1/2024