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
This commit is contained in:
Francisco Gamino 2023-04-19 19:41:21 -07:00 коммит произвёл GitHub
Родитель 87ff1d2bea
Коммит 25260ecd0b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 24 добавлений и 36 удалений

Просмотреть файл

@ -2,6 +2,7 @@
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="AzureFunctions@internalrelease" value="https://azfunc.pkgs.visualstudio.com/e6a70c92-4128-439f-8012-382fe78d6396/_packaging/AzureFunctions%40internalrelease/nuget/v3/index.json" />
<add key="AzureFunctions@staging" value="https://azfunc.pkgs.visualstudio.com/e6a70c92-4128-439f-8012-382fe78d6396/_packaging/AzureFunctions%40staging/nuget/v3/index.json" />
</packageSources>

Просмотреть файл

@ -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/ "<Azure Functions Host Root>/src/WebJobs.Script.WebHost/bin/Debug/net7.0/workers/powershell/7.4"
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"
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"
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"
```
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.

Просмотреть файл

@ -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 {

Просмотреть файл

@ -5,7 +5,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\PowerShellWorker.Common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

Просмотреть файл

@ -6,7 +6,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li
<Import Project="..\PowerShellWorker.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<TieredCompilation>true</TieredCompilation>
<Product>Azure Function PowerShell Language Worker</Product>
<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
<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.49.0" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.1" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.2" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Google.Protobuf" Version="3.21.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0-2.23152.6" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Просмотреть файл

@ -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()

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\PowerShellWorker.Common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
@ -10,7 +10,8 @@
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.1" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.0-preview.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0-2.23152.6" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -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'
}
}

Просмотреть файл

@ -6,7 +6,7 @@ Licensed under the MIT license. See LICENSE file in the project root for full li
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoBuild>true</NoBuild>
</PropertyGroup>