CommunityToolkit.Aspire.Hosting.Golang 13.1.1

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