Skip to content

Commit 25260ec

Browse files
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
1 parent 87ff1d2 commit 25260ec

File tree

10 files changed

+24
-36
lines changed

10 files changed

+24
-36
lines changed

NuGet.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<configuration>
33
<packageSources>
44
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
5+
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
56
<add key="AzureFunctions@internalrelease" value="https://azfunc.pkgs.visualstudio.com/e6a70c92-4128-439f-8012-382fe78d6396/_packaging/AzureFunctions%40internalrelease/nuget/v3/index.json" />
67
<add key="AzureFunctions@staging" value="https://azfunc.pkgs.visualstudio.com/e6a70c92-4128-439f-8012-382fe78d6396/_packaging/AzureFunctions%40staging/nuget/v3/index.json" />
78
</packageSources>

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ with any additional questions or comments.
4949

5050
### Prereqs
5151

52-
* [.NET 7.0 SDK](https://www.microsoft.com/net/download/visual-studio-sdks)
52+
* [.NET 8.0 SDK](https://www.microsoft.com/net/download/visual-studio-sdks)
5353

5454
### Build
5555

@@ -84,8 +84,8 @@ On macOS if you installed via `brew`
8484

8585
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:
8686
```powershell
87-
Copy-Item -Recurse -Force ./src/bin/Debug/net7.0/publish/ "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell/7.4"
88-
Copy-Item -Recurse -Force ./src/bin/Debug/net7.0/publish/worker.config.json "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell"
87+
Copy-Item -Recurse -Force ./src/bin/Debug/net8.0/publish/ "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell/7.4"
88+
Copy-Item -Recurse -Force ./src/bin/Debug/net8.0/publish/worker.config.json "/usr/local/Cellar/azure-functions-core-tools/$(func --version)/workers/powershell"
8989
```
9090

9191
> 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.
121121

122122
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`:
123123
```powershell
124-
Copy-Item -Recurse -Force ./src/bin/Debug/net7.0/publish/ "<Azure Functions Host Root>/src/WebJobs.Script.WebHost/bin/Debug/net7.0/workers/powershell/7.4"
125-
Copy-Item -Force ./src/bin/Debug/net7.0/publish/worker.config.json "<Azure Functions Host Root>/src/WebJobs.Script.WebHost/bin/Debug/net7.0/workers/powershell"
124+
Copy-Item -Recurse -Force ./src/bin/Debug/net8.0/publish/ "<Azure Functions Host Root>/src/WebJobs.Script.WebHost/bin/Debug/net8.0/workers/powershell/7.4"
125+
Copy-Item -Force ./src/bin/Debug/net8.0/publish/worker.config.json "<Azure Functions Host Root>/src/WebJobs.Script.WebHost/bin/Debug/net8.0/workers/powershell"
126126
```
127127

128128
Then you can start the host by running:
129129
```sh
130-
dotnet ./src/WebJobs.Script.WebHost/bin/Debug/net7.0/Microsoft.Azure.WebJobs.Script.WebHost.dll
130+
dotnet ./src/WebJobs.Script.WebHost/bin/Debug/net8.0/Microsoft.Azure.WebJobs.Script.WebHost.dll
131131
```
132132

133133
> Note: Remember to remove `"AzureWebJobsScriptRoot"`
@@ -149,6 +149,6 @@ That will place a `Microsoft.Azure.Functions.PowerShellWorker.*.nupkg` in:
149149

150150
It pulls the contents of the publish folder in:
151151

152-
`azure-functions-powershell-worker/src/bin/Debug/net7.0/publish`
152+
`azure-functions-powershell-worker/src/bin/Debug/net8.0/publish`
153153

154154
if you specify a different Configuration or TargetFramework that will be honored.

build.ps1

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,17 @@ param(
3434
$AddSBOM,
3535

3636
[string]
37-
$SBOMUtilSASUrl,
38-
39-
[string]
40-
[ValidateSet("7.2", "7.4")]
41-
$WorkerVersion
37+
$SBOMUtilSASUrl
4238
)
4339

4440
#Requires -Version 7.0
4541

4642
Import-Module "$PSScriptRoot/tools/helper.psm1" -Force
4743

48-
$PowerShellVersion = $null
49-
$TargetFramework = $null
50-
$DefaultPSWorkerVersion = '7.4'
51-
52-
if (-not $workerVersion)
53-
{
54-
Write-Log "Worker version not specified. Setting workerVersion to '$DefaultPSWorkerVersion'"
55-
$workerVersion = $DefaultPSWorkerVersion
56-
}
44+
$TargetFramework = 'net8.0'
45+
$PowerShellVersion = '7.4'
5746

58-
$PowerShellVersion = $WorkerVersion
5947
Write-Log "Build worker version: $PowerShellVersion"
60-
61-
# Set target framework for 7.2 to net6.0 and for 7.4 to net7.0
62-
$TargetFramework = ($PowerShellVersion -eq "7.2") ? 'net6.0' : 'net7.0'
6348
Write-Log "Target framework: $TargetFramework"
6449

6550
function Get-FunctionsCoreToolsDir {

package/Microsoft.Azure.Functions.PowerShellWorker.Package.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li
55
<Project Sdk="Microsoft.NET.Sdk">
66
<Import Project="..\PowerShellWorker.Common.props" />
77
<PropertyGroup>
8-
<TargetFramework>net7.0</TargetFramework>
8+
<TargetFramework>net8.0</TargetFramework>
99
<NoBuild>true</NoBuild>
1010
<IncludeBuildOutput>false</IncludeBuildOutput>
1111
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

src/Microsoft.Azure.Functions.PowerShellWorker.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li
66
<Import Project="..\PowerShellWorker.Common.props" />
77
<PropertyGroup>
88
<OutputType>Exe</OutputType>
9-
<TargetFramework>net7.0</TargetFramework>
9+
<TargetFramework>net8.0</TargetFramework>
1010
<TieredCompilation>true</TieredCompilation>
1111
<Product>Azure Function PowerShell Language Worker</Product>
1212
<AssemblyName>Microsoft.Azure.Functions.PowerShellWorker</AssemblyName>
@@ -21,10 +21,11 @@ Licensed under the MIT license. See LICENSE file in the project root for full li
2121

2222
<ItemGroup>
2323
<PackageReference Include="Grpc.Net.Client" Version="2.49.0" />
24-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.1" />
24+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.2" />
2525
<PackageReference Include="CommandLineParser" Version="2.9.1" />
2626
<PackageReference Include="Google.Protobuf" Version="3.21.9" />
2727
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
28+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0-2.23152.6" />
2829
</ItemGroup>
2930

3031
<ItemGroup>

test/E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E/Azure.Functions.PowerShellWorker.E2E.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

test/E2E/Start-E2ETest.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function NewTaskHubName
5858
$taskHubName = NewTaskHubName -Length 45
5959

6060
$FUNC_RUNTIME_VERSION = '4'
61-
$TARGET_FRAMEWORK = 'net7.0'
61+
$TARGET_FRAMEWORK = 'net8.0'
6262
$POWERSHELL_VERSION = '7.4'
6363

6464
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()

test/Unit/Microsoft.Azure.Functions.PowerShellWorker.Test.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="..\..\PowerShellWorker.Common.props" />
33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

@@ -10,7 +10,8 @@
1010
<PackageReference Include="Moq" Version="4.18.2" />
1111
<PackageReference Include="xunit" Version="2.4.2" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
13-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.1" />
13+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.2" />
14+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0-2.23152.6" />
1415
</ItemGroup>
1516

1617
<ItemGroup>

tools/helper.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ $DotnetSDKVersionRequirements = @{
1616
DefaultPatch = '426'
1717
}
1818

19-
'7.0' = @{
20-
MinimalPatch = '101'
21-
DefaultPatch = '101'
19+
'8.0' = @{
20+
MinimalPatch = '100-preview.3.23178.7'
21+
DefaultPatch = '100-preview.3.23178.7'
2222
}
2323
}
2424

tools/protobuf.tools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li
66
<Project Sdk="Microsoft.NET.Sdk">
77

88
<PropertyGroup>
9-
<TargetFramework>net7.0</TargetFramework>
9+
<TargetFramework>net8.0</TargetFramework>
1010
<NoBuild>true</NoBuild>
1111
</PropertyGroup>
1212

0 commit comments

Comments
 (0)