Skip to content

Commit f8a75eb

Browse files
authored
Run .NET Functions on .NET 8 and .NET 9 (#6517)
## Summary of changes Run the azure function integration tests on .NET 8 and .NET 9 ## Reason for change We currently only run them on .NET 6 and .NET 7, we should run them on all supported frameworks ## Implementation details - Update azure functions to build and run on .NET 8 and .NET 9 - ~set `DOTNET_ROOT` to the latest location of our installed SDKs (not technically necessary for this, but probably still a good idea to head off other issues)~ This seemed to _cause_ other issues 🙄 And isn't necessary AFAICT, so reverted it - Manually remove the "built-in" dotnet install in the azure functions test stage. Yes this is horrible. [But they have code to explicitly use it if it's there](https://github.com/Azure/azure-functions-host/blob/cb0a62c51dd800ee1919795b4a933b26c74ed8de/src/WebJobs.Script/Workers/Rpc/RpcWorkerDescription.cs#L160), and couldn't find an easy way to override it, so here we are. ## Test coverage More now! ## Other details I'm not proud of what I've done
1 parent 9606110 commit f8a75eb

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.azure-pipelines/ultimate-pipeline.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,12 @@ stages:
18111811
targetShaId: $(targetShaId)
18121812
targetBranch: $(targetBranch)
18131813
- template: steps/install-dotnet-sdks.yml
1814+
# This is a hack because otherwise Azure Functions _always_ tries to use the one from program files otherwise
1815+
- script: |
1816+
cd /D %PROGRAMFILES%/dotnet
1817+
rename dotnet.exe dotnet.exe.bak
1818+
where dotnet
1819+
displayName: 'Rename default dotnet.exe'
18141820
- template: steps/restore-working-directory.yml
18151821

18161822
- template: steps/install-msi.yml

tracer/build/_build/Build.VariableGenerations.cs

+2
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ void GenerateIntegrationTestsWindowsAzureFunctionsMatrix()
204204
// new {framework = TargetFramework.NETCOREAPP3_1, runtimeInstall = v3Install, runtimeUninstall = v3Uninstall },
205205
new {framework = TargetFramework.NET6_0 },
206206
new {framework = TargetFramework.NET7_0 },
207+
new {framework = TargetFramework.NET8_0 },
208+
new {framework = TargetFramework.NET9_0 },
207209
};
208210

209211
var matrix = new Dictionary<string, object>();

tracer/test/test-applications/azure-functions/Samples.AzureFunctions.V4Isolated/Samples.AzureFunctions.V4Isolated.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<ApiVersion Condition="'$(ApiVersion)' == ''">2.0.0</ApiVersion>
4-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
55
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
66
<OutputType>Exe</OutputType>
77
<ImplicitUsings>enable</ImplicitUsings>

0 commit comments

Comments
 (0)