@@ -63,7 +63,7 @@ triggered.
63
63
HTTP functions are deployed using ` --trigger-http ` . For example:
64
64
65
65
``` 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
67
67
```
68
68
69
69
On successful deployment, details of the deployed function will be
@@ -166,3 +166,39 @@ projects.
166
166
See [ the local NuGet packages example
167
167
documentation] ( examples.md#localnugetpackagefunction-and-localnugetpackagecode )
168
168
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