From 25260ecd0b3f5fdb1e3a9297b7b80ec26245f80c Mon Sep 17 00:00:00 2001 From: Francisco Gamino Date: Wed, 19 Apr 2023 19:41:21 -0700 Subject: [PATCH] Upgrade PowerShell 7.4 to SDK 7.4.0-preview.2 with .Net 8 Preview.3 (#940) * Upgrade to PowerShell SDK 7.4.0-preview.2 * Update build.ps1 script to only build the PS 7.4 worker * Upgrade to .NET SDK 8.0 * Add dotnet tools feed * Add PowerShell SDK 7.4.0-preview.2 dependency --- NuGet.config | 1 + README.md | 14 ++++++------- build.ps1 | 21 +++---------------- ....Functions.PowerShellWorker.Package.csproj | 2 +- ...ft.Azure.Functions.PowerShellWorker.csproj | 5 +++-- ...zure.Functions.PowerShellWorker.E2E.csproj | 2 +- test/E2E/Start-E2ETest.ps1 | 2 +- ...ure.Functions.PowerShellWorker.Test.csproj | 5 +++-- tools/helper.psm1 | 6 +++--- tools/protobuf.tools.csproj | 2 +- 10 files changed, 24 insertions(+), 36 deletions(-) diff --git a/NuGet.config b/NuGet.config index 4538c7d..c5e88ec 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,6 +2,7 @@ + diff --git a/README.md b/README.md index f4ae52f..c457eab 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ with any additional questions or comments. ### Prereqs -* [.NET 7.0 SDK](https://www.microsoft.com/net/download/visual-studio-sdks) +* [.NET 8.0 SDK](https://www.microsoft.com/net/download/visual-studio-sdks) ### Build @@ -84,8 +84,8 @@ On macOS if you installed via `brew` Under the `workers/powershell` folder, create a folder with the name `7.4` if it does not exist yet. Copy the result of the `publish` directory into the `workers/powershell/7.4` folder, and copy the `publish/worker.config.json` file into the `workers/powershell` folder: ```powershell -Copy-Item -Recurse -Force ./src/bin/Debug/net7.0/publish/ "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell/7.4" -Copy-Item -Recurse -Force ./src/bin/Debug/net7.0/publish/worker.config.json "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell" +Copy-Item -Recurse -Force ./src/bin/Debug/net8.0/publish/ "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell/7.4" +Copy-Item -Recurse -Force ./src/bin/Debug/net8.0/publish/worker.config.json "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell" ``` > NOTE: if the powershell folder already exists, you should delete it or debugging won't work. @@ -121,13 +121,13 @@ of your test functions app. Under the `workers/powershell` folder, create a folder with the name `7.4` if it does not exist yet. Then copy the `publish` directory to `workers/powershell/7.4`, and the `publish/worker.config.json` to `workers/powershell`: ```powershell -Copy-Item -Recurse -Force ./src/bin/Debug/net7.0/publish/ "/src/WebJobs.Script.WebHost/bin/Debug/net7.0/workers/powershell/7.4" -Copy-Item -Force ./src/bin/Debug/net7.0/publish/worker.config.json "/src/WebJobs.Script.WebHost/bin/Debug/net7.0/workers/powershell" +Copy-Item -Recurse -Force ./src/bin/Debug/net8.0/publish/ "/src/WebJobs.Script.WebHost/bin/Debug/net8.0/workers/powershell/7.4" +Copy-Item -Force ./src/bin/Debug/net8.0/publish/worker.config.json "/src/WebJobs.Script.WebHost/bin/Debug/net8.0/workers/powershell" ``` Then you can start the host by running: ```sh -dotnet ./src/WebJobs.Script.WebHost/bin/Debug/net7.0/Microsoft.Azure.WebJobs.Script.WebHost.dll +dotnet ./src/WebJobs.Script.WebHost/bin/Debug/net8.0/Microsoft.Azure.WebJobs.Script.WebHost.dll ``` > Note: Remember to remove `"AzureWebJobsScriptRoot"` @@ -149,6 +149,6 @@ That will place a `Microsoft.Azure.Functions.PowerShellWorker.*.nupkg` in: It pulls the contents of the publish folder in: -`azure-functions-powershell-worker/src/bin/Debug/net7.0/publish` +`azure-functions-powershell-worker/src/bin/Debug/net8.0/publish` if you specify a different Configuration or TargetFramework that will be honored. diff --git a/build.ps1 b/build.ps1 index a1bf0ec..3d7615f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -34,32 +34,17 @@ param( $AddSBOM, [string] - $SBOMUtilSASUrl, - - [string] - [ValidateSet("7.2", "7.4")] - $WorkerVersion + $SBOMUtilSASUrl ) #Requires -Version 7.0 Import-Module "$PSScriptRoot/tools/helper.psm1" -Force -$PowerShellVersion = $null -$TargetFramework = $null -$DefaultPSWorkerVersion = '7.4' +$TargetFramework = 'net8.0' +$PowerShellVersion = '7.4' -if (-not $workerVersion) -{ - Write-Log "Worker version not specified. Setting workerVersion to '$DefaultPSWorkerVersion'" - $workerVersion = $DefaultPSWorkerVersion -} - -$PowerShellVersion = $WorkerVersion Write-Log "Build worker version: $PowerShellVersion" - -# Set target framework for 7.2 to net6.0 and for 7.4 to net7.0 -$TargetFramework = ($PowerShellVersion -eq "7.2") ? 'net6.0' : 'net7.0' Write-Log "Target framework: $TargetFramework" function Get-FunctionsCoreToolsDir { diff --git a/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj b/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj index 20149e7..5d21fdd 100644 --- a/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj +++ b/package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj @@ -5,7 +5,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li - net7.0 + net8.0 true false true diff --git a/src/Microsoft.Azure.Functions.PowerShellWorker.csproj b/src/Microsoft.Azure.Functions.PowerShellWorker.csproj index aef8047..20267a2 100644 --- a/src/Microsoft.Azure.Functions.PowerShellWorker.csproj +++ b/src/Microsoft.Azure.Functions.PowerShellWorker.csproj @@ -6,7 +6,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li Exe - net7.0 + net8.0 true Azure Function PowerShell Language Worker Microsoft.Azure.Functions.PowerShellWorker @@ -21,10 +21,11 @@ Licensed under the MIT license. See LICENSE file in the project root for full li - + + diff --git a/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E.csproj b/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E.csproj index 0810259..b607936 100644 --- a/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E.csproj +++ b/test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 false diff --git a/test/E2E/Start-E2ETest.ps1 b/test/E2E/Start-E2ETest.ps1 index 712a127..24e6ff4 100644 --- a/test/E2E/Start-E2ETest.ps1 +++ b/test/E2E/Start-E2ETest.ps1 @@ -58,7 +58,7 @@ function NewTaskHubName $taskHubName = NewTaskHubName -Length 45 $FUNC_RUNTIME_VERSION = '4' -$TARGET_FRAMEWORK = 'net7.0' +$TARGET_FRAMEWORK = 'net8.0' $POWERSHELL_VERSION = '7.4' $arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant() diff --git a/test/Unit/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj b/test/Unit/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj index 4c81980..b96085c 100644 --- a/test/Unit/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj +++ b/test/Unit/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false @@ -10,7 +10,8 @@ - + + diff --git a/tools/helper.psm1 b/tools/helper.psm1 index 75fbc59..47d9e28 100644 --- a/tools/helper.psm1 +++ b/tools/helper.psm1 @@ -16,9 +16,9 @@ $DotnetSDKVersionRequirements = @{ DefaultPatch = '426' } - '7.0' = @{ - MinimalPatch = '101' - DefaultPatch = '101' + '8.0' = @{ + MinimalPatch = '100-preview.3.23178.7' + DefaultPatch = '100-preview.3.23178.7' } } diff --git a/tools/protobuf.tools.csproj b/tools/protobuf.tools.csproj index 45ea8d6..b1c0658 100644 --- a/tools/protobuf.tools.csproj +++ b/tools/protobuf.tools.csproj @@ -6,7 +6,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li - net7.0 + net8.0 true