# .NET 6 support in Google Cloud Buildpacks and Cloud Run

Author: [Mete Atamel](https://atamel.dev/) | Published: 2022-02-04 | Topics: .NET, Serverless, Google Cloud Platform, How To | Canonical: https://atamel.dev/posts/2022/02-04_dotnet6_buildpacks_cloudrun/


I really like the idea of containers, a reproducible context that our apps can
rely on. However, I really dislike having to create a `Dockerfile` to define my
container images. I always need to copy & paste it from somewhere and it takes me
some time to get it right.

That's why I like using [Google Cloud
Buildpacks](https://github.com/GoogleCloudPlatform/buildpacks) to build
containers without having to worry about a `Dockerfile`.

**I'm happy to announce that, as of yesterday, Google Cloud Buildpacks now
supports .NET 6 (the latest LTS version) apps as well!**

What does this mean for you?

Here's a [.NET 6 Hello World
app](https://github.com/meteatamel/cloudrun-dotnet-6) with a `Dockerfile`.

You can build the container image and deploy to Cloud Run in one step:

```sh
gcloud run deploy $SERVICE_NAME \
  --source . \
  --allow-unauthenticated \
  --region $REGION
```

This uses the .NET buildpack and the `Dockerfile` to build the container image
and then deploy to Cloud Run:

```sh
This command is equivalent to running `gcloud builds submit --tag [IMAGE] .` and `gcloud run deploy dotnet6 --image [IMAGE]`

Building using Dockerfile and deploying container to Cloud Run service [dotnet6] in project [dotnet-atamel] region [europe-west1]
```

Better yet, if you remove the `Dockerfile`, the .NET buildpack detects the .NET
version and builds the image for you:

```sh
This command is equivalent to running `gcloud builds submit --pack image=[IMAGE] .` and `gcloud run deploy dotnet6 --image [IMAGE]`

Building using Buildpacks and deploying container to Cloud Run service [dotnet6] in project [knative-atamel] region [europe-west1]
```

This not only works for .NET 6 but for .NET 5 and all the .NET versions after
.NET Core 1.0!

---

Feel free to reach out to me on Twitter [@meteatamel](https://twitter.com/meteatamel)
for any questions/feedback.

