Skip to content

Commit dcbcfa0

Browse files
committed
docs: Deployment instructions for .NET 8
Note that we don't have any examples targeting .NET 8, partly as we're still building on .NET 6.
1 parent 99c902e commit dcbcfa0

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

docs/deployment.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ triggered.
6363
HTTP functions are deployed using `--trigger-http`. For example:
6464

6565
```text
66-
gcloud functions deploy hello-functions --runtime dotnet3 --trigger-http --entry-point HelloFunctions.Function
66+
gcloud functions deploy hello-functions --runtime dotnet6 --trigger-http --entry-point HelloFunctions.Function
6767
```
6868

6969
On successful deployment, details of the deployed function will be
@@ -166,3 +166,39 @@ projects.
166166
See [the local NuGet packages example
167167
documentation](examples.md#localnugetpackagefunction-and-localnugetpackagecode)
168168
for more details.
169+
170+
### Deploying a .NET 8 function
171+
172+
You can build and deploy .NET 8 functions with the Functions
173+
Framework using the Cloud Functions "2nd gen" version.
174+
175+
First, edit your project file to target the `net8.0` target
176+
framework moniker. Just change this line in your project file:
177+
178+
```xml
179+
<TargetFramework>net6.0</TargetFramework>
180+
```
181+
182+
to this:
183+
184+
```xml
185+
<TargetFramework>net8.0</TargetFramework>
186+
```
187+
188+
If you do this within Visual Studio, you may be prompted to reload
189+
the project. If you *aren't* prompted to do so, but see spurious
190+
build failures, simply unload the project and reload it - or restart
191+
Visual Studio.
192+
193+
Next, when deploying, you need to specify the `dotnet8` runtime
194+
instead of `dotnet6`, and specify the `--gen2` command line option
195+
to deploy on Cloud Functions 2nd gen. So for example:
196+
197+
```sh
198+
gcloud functions deploy dotnet8-test \
199+
--gen2 \
200+
--runtime dotnet8
201+
--trigger-http
202+
--allow-unauthenticated
203+
--entry-point TestDotnet8.Function
204+
```

0 commit comments

Comments
 (0)