upgrade to dotnet 8.0

This commit is contained in:
Rui Lopes 2025-06-06 07:12:40 +00:00
parent 19aac97f75
commit a54d6dd97f
2 changed files with 13 additions and 13 deletions

View File

@ -1,10 +1,14 @@
#!/bin/bash
set -euxo pipefail
# pin the microsoft apt repository above the distro.
# opt-out of telemetry.
echo 'export DOTNET_CLI_TELEMETRY_OPTOUT=1' >/etc/profile.d/opt-out-dotnet-cli-telemetry.sh
source /etc/profile.d/opt-out-dotnet-cli-telemetry.sh
# pin the microsoft apt repository packages above the distro ones.
# see apt-cache policy
# see apt-cache policy dotnet-sdk-6.0
# see apt-cache showpkg dotnet-sdk-6.0
# see apt-cache policy dotnet-sdk-8.0
# see apt-cache showpkg dotnet-sdk-8.0
# see http://manpages.ubuntu.com/manpages/jammy/en/man5/apt_preferences.5.html
cat >/etc/apt/preferences.d/packages.microsoft.com.pref <<'EOF'
Package: *
@ -12,18 +16,14 @@ Pin: origin "packages.microsoft.com"
Pin-Priority: 999
EOF
# opt-out of telemetry.
echo 'export DOTNET_CLI_TELEMETRY_OPTOUT=1' >/etc/profile.d/opt-out-dotnet-cli-telemetry.sh
source /etc/profile.d/opt-out-dotnet-cli-telemetry.sh
# install the dotnet core sdk.
# see https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
# see https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
wget -qO packages-microsoft-prod.deb "https://packages.microsoft.com/config/ubuntu/$(lsb_release -s -r)/packages-microsoft-prod.deb"
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt-get install -y apt-transport-https
apt-get update
apt-get install -y dotnet-sdk-6.0
apt-get install -y dotnet-sdk-8.0
# show versions.
dotnet --info

View File

@ -68,7 +68,7 @@ dotnet nuget list source
cat >example-hello-world.csproj <<'EOF'
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Version>1.0.0</Version>
<Authors>Alice Doe</Authors>
<Copyright>Copyleft Alice Doe</Copyright>
@ -82,7 +82,7 @@ cat >example-hello-world.csproj <<'EOF'
</NuspecProperties>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog" Version="4.3.0" />
</ItemGroup>
</Project>
EOF
@ -127,7 +127,7 @@ cat >test.csproj <<'EOF'
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
EOF
@ -159,7 +159,7 @@ EOF
dotnet nuget list source
dotnet add package example-hello-world
# see https://www.nuget.org/packages/Serilog.Sinks.Console/
dotnet add package Serilog.Sinks.Console --version 4.1.0
dotnet add package Serilog.Sinks.Console --version 6.0.0
dotnet build -v=n -c=Release
dotnet publish -v=n -c=Release --no-build --output dist
./dist/test