diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6f110512d..7beae0fc6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -41,7 +41,9 @@ extends: enabled: true pool: name: NetCore1ESPool-Svc-Internal - image: 1es-windows-2019 + demands: + - ImageOverride -equals windows.vs2019.amd64 + - ImageVersionOverride -equals 2026.0304.014948 os: windows stages: - stage: build diff --git a/build.cmd b/build.cmd index 5802269fe..b6d145dff 100644 --- a/build.cmd +++ b/build.cmd @@ -37,10 +37,10 @@ if not DEFINED InstallDir ( goto BuildFail ) -REM Find a 64bit MSBuild and add it to path. Require v17.4 or later due to our .NET SDK choice. +REM Find a 64bit MSBuild and add it to path. Require v17.8.3 or later due to our .NET SDK choice. REM Check for VS2022 first. set InstallDir= -for /f "usebackq tokens=*" %%i in (`%vswhere% -version 17.4 -latest -prerelease -products * ^ +for /f "usebackq tokens=*" %%i in (`%vswhere% -version 17.8.3 -latest -prerelease -products * ^ -requires Microsoft.Component.MSBuild ^ -property installationPath`) do ( set "InstallDir=%%i" @@ -52,10 +52,36 @@ if DEFINED InstallDir ( goto FoundMSBuild ) +REM VS2022 with MSBuild v17.8.3+ not found. Check for standalone MSBuild SDK. +set "StandaloneSdkBase=C:\msbuild-standalone\sdk" +set "StandaloneMSBuildDir=" +echo "Looking in msbuild-standalone dir" +if exist "%StandaloneSdkBase%" ( + for /f "delims=" %%d in ('dir /b /ad /o-n "%StandaloneSdkBase%"') do ( + echo "Looking in %StandaloneSdkBase%\%%d\MSBuild.dll" + if exist "%StandaloneSdkBase%\%%d\MSBuild.dll" ( + set "StandaloneMSBuildDir=%StandaloneSdkBase%\%%d" + goto CheckStandaloneVersion + ) + ) +) +goto SkipStandalone + +:CheckStandaloneVersion +echo "Checking standalone version" +for /f "usebackq tokens=*" %%v in (`dotnet exec "%StandaloneMSBuildDir%\MSBuild.dll" -nologo -version`) do set "MSBuildVer=%%v" +PowerShell -NoProfile -NoLogo -Command "if ([version]'%MSBuildVer%' -ge [version]'17.8.3') { exit 0 } else { exit 1 }" +if not errorlevel 1 ( + set "PATH=%StandaloneMSBuildDir%;%PATH%" + goto FoundMSBuild +) + +:SkipStandalone + REM Otherwise find or install an xcopy-able MSBuild. echo "Could not find a VS2022 installation with the necessary components (MSBuild). Falling back..." -set "MSBuildVersion=17.4.1" +set "MSBuildVersion=17.8.5" set "Command=[System.Threading.Thread]::CurrentThread.CurrentCulture = ''" set "Command=%Command%; [System.Threading.Thread]::CurrentThread.CurrentUICulture = ''" set "Command=%Command%; try { & '%~dp0eng\GetXCopyMSBuild.ps1' %MSBuildVersion%; exit $LASTEXITCODE }" diff --git a/eng/templates/default-build.yml b/eng/templates/default-build.yml index 7000a4dad..b76d242c3 100644 --- a/eng/templates/default-build.yml +++ b/eng/templates/default-build.yml @@ -8,7 +8,9 @@ jobs: ${{ if eq(variables['System.TeamProject'], 'public') }}: pool: name: NetCore-Svc-Public - demands: ImageOverride -equals windows.vs2019.amd64.open + demands: + - ImageOverride -equals windows.vs2019.amd64.open + - ImageVersionOverride -equals 2026.0304.014948 timeoutInMinutes: 30 strategy: diff --git a/global.json b/global.json index 0f75e8a6f..fa8b53441 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.405", + "version": "8.0.413", "rollForward": "major" } } diff --git a/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj b/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj index d22704250..f371bab19 100644 --- a/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj +++ b/test/Microsoft.TestCommon/Microsoft.TestCommon.csproj @@ -1,7 +1,7 @@  - net462;netcoreapp2.1;net6.0 + net462;netcoreapp2.1;net8.0 $(Configurations);CodeAnalysis $(DefineConstants);Testing_NetStandard1_3 diff --git a/test/System.Net.Http.Formatting.Test/ByteRangeStreamContentTest.cs b/test/System.Net.Http.Formatting.Test/ByteRangeStreamContentTest.cs index 410fc2b24..7dbed8f7d 100644 --- a/test/System.Net.Http.Formatting.Test/ByteRangeStreamContentTest.cs +++ b/test/System.Net.Http.Formatting.Test/ByteRangeStreamContentTest.cs @@ -127,7 +127,8 @@ public void Ctor_ThrowsOnNullMediaTypeString() range: range, mediaType: (String)null, bufferSize: 128), - "mediaType"); + "mediaType", + allowDerivedExceptions: true); } [Fact] diff --git a/test/System.Net.Http.Formatting.ns1_3.Test/System.Net.Http.Formatting.ns1_3.Test.csproj b/test/System.Net.Http.Formatting.ns1_3.Test/System.Net.Http.Formatting.ns1_3.Test.csproj index cfd42c053..74c763d46 100644 --- a/test/System.Net.Http.Formatting.ns1_3.Test/System.Net.Http.Formatting.ns1_3.Test.csproj +++ b/test/System.Net.Http.Formatting.ns1_3.Test/System.Net.Http.Formatting.ns1_3.Test.csproj @@ -1,7 +1,7 @@  - net462;netcoreapp2.1;net6.0 + net462;netcoreapp2.1;net8.0 System.Net.Http ..\..\bin\$(Configuration)\Test\ns1_3\ $(Configurations);CodeAnalysis diff --git a/test/System.Net.Http.Formatting.ns2_0.Test/System.Net.Http.Formatting.ns2_0.Test.csproj b/test/System.Net.Http.Formatting.ns2_0.Test/System.Net.Http.Formatting.ns2_0.Test.csproj index 8c7958b39..31a0b9548 100644 --- a/test/System.Net.Http.Formatting.ns2_0.Test/System.Net.Http.Formatting.ns2_0.Test.csproj +++ b/test/System.Net.Http.Formatting.ns2_0.Test/System.Net.Http.Formatting.ns2_0.Test.csproj @@ -1,7 +1,7 @@  - net462;netcoreapp2.1;net6.0 + net462;netcoreapp2.1;net8.0 System.Net.Http ..\..\bin\$(Configuration)\Test\ns2_0\ $(Configurations);CodeAnalysis