Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .azure-pipelines/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ jobs:
${{ if eq(parameters.targetFramework, 'all') }}:
strategy:
matrix:
NET6.0:
targetFramework: 'net6.0'
NET8.0:
targetFramework: 'net8.0'
NET10.0:
targetFramework: 'net10.0'


${{ if ne(parameters.container, '') }}:
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ extends:
${{ if eq(parameters.targetFramework, 'all') }}:
strategy:
matrix:
NET6.0:
targetFramework: 'net6.0'
NET8.0:
targetFramework: 'net8.0'
NET10.0:
targetFramework: 'net10.0'
pool:
name: 1ES-ABTT-Shared-Pool
image: abtt-ubuntu-2404
Expand Down
2 changes: 1 addition & 1 deletion .vsts.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extends:
publishArtifacts: ${{ ne(variables['Build.Reason'], 'PullRequest') }}
buildAlternatePackage: false
testProxyAgent: ${{ parameters.testProxyAgent }}
targetFramework: 'net8.0'
targetFramework: 'all'
win_x64: ${{ parameters.win_x64 }}
win_x86: ${{ parameters.win_x86 }}
win_arm64: ${{ parameters.win_arm64 }}
Expand Down
9 changes: 5 additions & 4 deletions .vsts.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ parameters:
- name: targetFramework
displayName: Target framework
type: string
default: net8.0
default: net10.0
values:
- net8.0
- net10.0

- name: derivedFrom
type: string
Expand Down Expand Up @@ -145,9 +146,9 @@ extends:

## Verify target framework for specified version
$majorVersion = $agentVersion.Split('.')[0]
if (("${{ parameters.targetFramework }}" -eq "net6.0" -and $majorVersion -ne "3") -or
("${{ parameters.targetFramework }}" -eq "net8.0" -and $majorVersion -ne "4")) {
Write-Error "The major version should be 3 for net6.0 and 4 for net8.0" -ErrorAction Stop
if (("${{ parameters.targetFramework }}" -eq "net8.0" -and $majorVersion -ne "4") -or
("${{ parameters.targetFramework }}" -eq "net10.0" -and $majorVersion -ne "5")) {
Write-Error "The major version should be 4 for net8.0 and 5 for net10.0" -ErrorAction Stop
}
}
if ($isTestRun) {
Expand Down
8 changes: 4 additions & 4 deletions src/Agent.Listener/Agent.Listener.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<PackageReference Include="CommandLineParser" Version="2.7.82" />
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.230.0-preview" />
<PackageReference Include="Microsoft.VisualStudio.Services.InteractiveClient" Version="19.230.0-preview" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
<PackageReference Include="vss-api-netcore" Version="$(VssApiVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="7.0.2" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="2.0.5" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" Condition="$(TargetFramework.StartsWith('net8'))" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Agent.PluginHost/Agent.PluginHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<ProjectReference Include="..\Agent.Sdk\Agent.Sdk.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="vss-api-netcore" Version="$(VssApiVersion)" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="2.0.5" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" Condition="$(TargetFramework.StartsWith('net8'))" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/Agent.Plugins/Agent.Plugins.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<PackageReference Include="vss-api-netcore" Version="$(VssApiVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="7.0.2" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="2.0.5" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" Condition="$(TargetFramework.StartsWith('net8'))" />
</ItemGroup>
</Project>
12 changes: 6 additions & 6 deletions src/Agent.Sdk/Agent.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@

<ItemGroup>
<PackageReference Include="Microsoft.Security.Utilities.Core" Version="1.19.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
<PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="2.0.5" />
<PackageReference Include="vss-api-netcore" Version="$(VssApiVersion)" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.1" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="8.0.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="8.0.0" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="Azure.Core" Version="1.44.1" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/Agent.Worker/Agent.Worker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<PackageReference Include="vss-api-netcore" Version="$(VssApiVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="7.0.2" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="2.0.5" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" Condition="$(TargetFramework.StartsWith('net8'))" />
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion src/Common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<Project>
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFramework Condition="'$(NetTargetFramework)' != ''">$(NetTargetFramework)</TargetFramework>
<TargetFramework Condition="'$(NetTargetFramework)' == ''">net10.0</TargetFramework>
<RuntimeFrameworkVersion Condition="'$(NetRuntimeFrameworkVersion)' != ''">$(NetRuntimeFrameworkVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition="'$(NetRuntimeFrameworkVersion)' == ''">10.0.1</RuntimeFrameworkVersion>
<RuntimeIdentifier Condition="'$(BuildingInsideVisualStudio)' != 'true'">$(PackageRuntime)</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.1" />
<PackageReference Include="System.Security.Principal.Windows" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="vss-api-netcore" Version="$(VssApiVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="7.0.2" />
<PackageReference Include="Microsoft.Azure.Storage.DataMovement" Version="2.0.5" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" Condition="$(TargetFramework.StartsWith('net8'))" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="8.0.0" Condition="$(TargetFramework.StartsWith('net8'))" />
</ItemGroup>

</Project>
10 changes: 7 additions & 3 deletions src/Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@

<ItemGroup>
<PackageReference Include="azuredevops-testresultparser" Version="1.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="16.4.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="16.4.0" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.CodeCoverage" Version="18.0.1" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="18.0.1" GeneratePathProperty="true">
<!-- Exclude build assets to prevent testhost.exe from being copied to output.
VSTest will use dotnet testhost.dll instead which properly respects DOTNET_ROOT. -->
<ExcludeAssets>build</ExcludeAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />
Expand Down
51 changes: 38 additions & 13 deletions src/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

source "$SCRIPT_DIR/.helpers.sh"

REPO_ROOT="${SCRIPT_DIR}/.."
# Resolve REPO_ROOT to absolute path without '..' for proper runtime resolution
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
AGENT_VERSION=$(cat "$SCRIPT_DIR/agentversion" | head -n 1 | tr -d "\n\r")

DOTNET_ERROR_PREFIX="##vso[task.logissue type=error]"
Expand All @@ -34,25 +35,32 @@ fi

pushd "$SCRIPT_DIR"

DEFAULT_TARGET_FRAMEWORK="net8.0"
DEFAULT_TARGET_FRAMEWORK="net10.0"

if [[ $TARGET_FRAMEWORK == "" ]]; then
TARGET_FRAMEWORK=$DEFAULT_TARGET_FRAMEWORK
fi

# Validate target framework - only allow known values
ALLOWED_FRAMEWORKS=("net8.0" "net10.0")
if [[ ! " ${ALLOWED_FRAMEWORKS[*]} " =~ " ${TARGET_FRAMEWORK} " ]]; then
failed "Invalid target framework '${TARGET_FRAMEWORK}'. Allowed values: ${ALLOWED_FRAMEWORKS[*]}"
fi

function get_net_version() {
local dotnet_versions="
net6.0-sdk=6.0.424
net6.0-runtime=6.0.32


net8.0-sdk=8.0.416
net8.0-runtime=8.0.22

net10.0-sdk=10.0.101
net10.0-runtime=10.0.1
"

echo "$dotnet_versions" | grep -o "$1=[^ ]*" | cut -d '=' -f2
}

DOTNET_SDK_VERSION=$(get_net_version "net8.0-sdk")
DOTNET_SDK_VERSION=$(get_net_version "${TARGET_FRAMEWORK}-sdk")
DOTNET_RUNTIME_VERSION=$(get_net_version "${TARGET_FRAMEWORK}-runtime")

if [[ ($DOTNET_SDK_VERSION == "") || ($DOTNET_RUNTIME_VERSION == "") ]]; then
Expand Down Expand Up @@ -115,23 +123,26 @@ function restore_sdk_and_runtime() {
function warn_about_newer_versions() {
echo ""

# Extract major version from TARGET_FRAMEWORK (e.g., net10.0 -> 10.0, net8.0 -> 8.0)
local dotnet_major_version="${TARGET_FRAMEWORK#net}"

# Use official .NET APIs to get latest versions
local latest_sdk latest_runtime
local sdk_outdated=false
local runtime_outdated=false

# Get latest SDK version from official .NET feed
latest_sdk=$(curl -s "https://builds.dotnet.microsoft.com/dotnet/Sdk/8.0/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "")
latest_sdk=$(curl -s "https://builds.dotnet.microsoft.com/dotnet/Sdk/${dotnet_major_version}/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "")
if [[ -z "$latest_sdk" ]]; then
# Fallback to backup feed
latest_sdk=$(curl -s "https://ci.dot.net/public/Sdk/8.0/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "$DOTNET_SDK_VERSION")
latest_sdk=$(curl -s "https://ci.dot.net/public/Sdk/${dotnet_major_version}/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "$DOTNET_SDK_VERSION")
fi

# Get latest Runtime version from official .NET feed
latest_runtime=$(curl -s "https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "")
latest_runtime=$(curl -s "https://builds.dotnet.microsoft.com/dotnet/Runtime/${dotnet_major_version}/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "")
if [[ -z "$latest_runtime" ]]; then
# Fallback to backup feed
latest_runtime=$(curl -s "https://ci.dot.net/public/Runtime/8.0/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "$DOTNET_RUNTIME_VERSION")
latest_runtime=$(curl -s "https://ci.dot.net/public/Runtime/${dotnet_major_version}/latest.version" 2>/dev/null | tail -n 1 | tr -d '\r\n' || echo "$DOTNET_RUNTIME_VERSION")
fi

# Check SDK version
Expand All @@ -145,7 +156,7 @@ function warn_about_newer_versions() {
fi

if [[ "$sdk_outdated" == "true" || "$runtime_outdated" == "true" ]]; then
echo "⚠️ WARNING: Newer .NET 8.0 versions available:" >&2
echo "⚠️ WARNING: Newer .NET ${dotnet_major_version} versions available:" >&2
if [[ "$sdk_outdated" == "true" ]]; then
echo " SDK: $latest_sdk (currently using $DOTNET_SDK_VERSION)" >&2
fi
Expand Down Expand Up @@ -389,7 +400,7 @@ function cmd_report() {

# for some reason CodeCoverage.exe will only write the output file in the current directory
pushd $COVERAGE_REPORT_DIR >/dev/null
"${HOME}/.nuget/packages/microsoft.codecoverage/16.4.0/build/netstandard1.0/CodeCoverage/CodeCoverage.exe" analyze "/output:coverage.xml" "$LATEST_COVERAGE_FILE"
"${HOME}/.nuget/packages/microsoft.codecoverage/18.0.1/build/netstandard1.0/CodeCoverage/CodeCoverage.exe" analyze "/output:coverage.xml" "$LATEST_COVERAGE_FILE"
popd >/dev/null

if ! command -v reportgenerator.exe >/dev/null; then
Expand Down Expand Up @@ -483,11 +494,25 @@ REPORT_DIR="${REPO_ROOT}/_reports/${RUNTIME_ID}"
restore_dotnet_install_script
restore_sdk_and_runtime


heading ".NET SDK to path"
echo "Adding .NET SDK to PATH (${DOTNET_DIR})"
export PATH=${DOTNET_DIR}:$PATH
export PATH=${DOTNET_DIR}/sdk/${DOTNET_SDK_VERSION}:${DOTNET_DIR}:$PATH
export PATH=${NUGET_DIR}:$PATH

# Set DOTNET_ROOT - on Windows, convert to Windows-style path for native dotnet commands
if [[ "$CURRENT_PLATFORM" == 'windows' ]]; then
# Convert /c/path to C:\path format for Windows
dotnet_root_windows=${DOTNET_DIR:1}
dotnet_root_windows=${dotnet_root_windows:0:1}:${dotnet_root_windows:1}
dotnet_root_windows=$(echo "$dotnet_root_windows" | sed 's|/|\\|g')
export DOTNET_ROOT="$dotnet_root_windows"
else
export DOTNET_ROOT=${DOTNET_DIR}
fi

echo "Path = $PATH"
echo "DOTNET_ROOT = $DOTNET_ROOT"
echo ".NET Version = $(dotnet --version)"

heading "Pre-caching external resources for $RUNTIME_ID"
Expand Down
Loading
Loading