Skip to content

Commit a58d0f1

Browse files
Supporting dotnet 10.0 preview version (#1305)
* Supporting dotnet 10.0 preview version * Changing the test to fetch actual LTS version. * To resolve the conflict * To resolve conflict again * Version bump and adding back the azureedge url's as those should be removed by the automated version update PR * To resolve conflict again * Final version bump * Reverting back the test script change as created separate PR for that. * Ubuntu EOL changes and additional info about dotnet 10.0-preview version. * Correcting the comment. * Updates based on review comments to use '-preview' in the label as suffix. * Removed reame file change as suggested. * Update src/dotnet/README.md * Inconsequential change to rerun the failed test --------- Co-authored-by: Álvaro Rausell Guiard <33221237+AlvaroRausell@users.noreply.github.com>
1 parent 149d303 commit a58d0f1

10 files changed

+130
-33
lines changed

src/dotnet/devcontainer-feature.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "dotnet",
3-
"version": "2.2.1",
3+
"version": "2.3.0",
44
"name": "Dotnet CLI",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
66
"description": "This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.",
@@ -11,6 +11,7 @@
1111
"latest",
1212
"lts",
1313
"none",
14+
"10.0-preview",
1415
"8.0",
1516
"7.0",
1617
"6.0"

src/dotnet/install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ done
108108
check_packages wget ca-certificates icu-devtools
109109

110110
for version in "${versions[@]}"; do
111-
install_sdk "$version"
111+
# Remove '-preview' from version if suffixed with the version label
112+
clean_version="$(echo "$version" | sed 's/-preview$//')"
113+
install_sdk "$clean_version"
112114
done
113115

114116
for version in "${dotnetRuntimeVersions[@]}"; do

src/dotnet/scripts/vendor/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ dotnet-install.sh [--version latest] --channel 6.0 [--quality GA]
2323
dotnet-install.sh [--version latest] --channel 6.0.4xx [--quality GA]
2424
dotnet-install.sh [--version latest] --channel 8.0 --quality preview
2525
dotnet-install.sh [--version latest] --channel 8.0 --quality daily
26+
dotnet-install.sh [--version latest] --channel 10.0 --quality preview
2627
dotnet-install.sh --version 6.0.413
2728
```

test/dotnet/install_dotnet_multiple_versions.sh

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,8 @@ is_dotnet_sdk_version_installed "8.0"
2222
check ".NET SDK 7.0 installed" \
2323
is_dotnet_sdk_version_installed "7.0"
2424

25-
check ".NET SDK 6.0 installed" \
26-
is_dotnet_sdk_version_installed "6.0"
27-
28-
check ".NET SDK 5.0 installed" \
29-
is_dotnet_sdk_version_installed "5.0"
30-
31-
check ".NET Core SDK 3.1 installed" \
32-
is_dotnet_sdk_version_installed "3.1"
25+
check ".NET SDK 10.0 installed" \
26+
is_dotnet_sdk_version_installed "10.0"
3327

3428
check "Build example class library" \
3529
dotnet build projects/multitargeting
@@ -43,14 +37,8 @@ dotnet run --project projects/net8.0
4337
check "Build and run .NET 7.0 project" \
4438
dotnet run --project projects/net7.0
4539

46-
check "Build and run .NET 6.0 project" \
47-
dotnet run --project projects/net6.0
48-
49-
check "Build and run .NET 5.0 project" \
50-
dotnet run --project projects/net5.0
51-
52-
check "Build and run .NET Core 3.1 project" \
53-
dotnet run --project projects/netcoreapp3.1
40+
check "Build and run .NET 10.0 project" \
41+
dotnet run --project projects/net10.0
5442

5543
# Report results
5644
# If any of the checks above exited with a non-zero exit code, the test will fail.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library bundled with the devcontainer CLI
6+
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
7+
# Provides the 'check' and 'reportResults' commands.
8+
source dev-container-features-test-lib
9+
10+
# Feature-specific tests
11+
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
12+
# check <LABEL> <cmd> [args...]
13+
source dotnet_env.sh
14+
source dotnet_helpers.sh
15+
16+
check ".NET SDK 9.0 installed" \
17+
is_dotnet_sdk_version_installed "9.0"
18+
19+
check ".NET SDK 8.0 installed" \
20+
is_dotnet_sdk_version_installed "8.0"
21+
22+
check ".NET SDK 7.0 installed" \
23+
is_dotnet_sdk_version_installed "7.0"
24+
25+
check ".NET SDK 10.0 installed" \
26+
is_dotnet_sdk_version_installed "10.0"
27+
28+
check "Build example class library" \
29+
dotnet build projects/multitargeting
30+
31+
check "Build and run .NET 9.0 project" \
32+
dotnet run --project projects/net9.0
33+
34+
check "Build and run .NET 8.0 project" \
35+
dotnet run --project projects/net8.0
36+
37+
check "Build and run .NET 7.0 project" \
38+
dotnet run --project projects/net7.0
39+
40+
check "Build and run .NET 10.0 project" \
41+
dotnet run --project projects/net10.0
42+
43+
# Report results
44+
# If any of the checks above exited with a non-zero exit code, the test will fail.
45+
reportResults
46+
47+

test/dotnet/install_dotnet_specific_release.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ source dev-container-features-test-lib
1313
source dotnet_env.sh
1414
source dotnet_helpers.sh
1515

16-
expected=$(fetch_latest_version_in_channel "3.1")
16+
expected=$(fetch_latest_version_in_channel "8.0")
1717

18-
check ".NET Core SDK 3.1 installed" \
18+
check ".NET Core SDK 8.0 installed" \
1919
is_dotnet_sdk_version_installed "$expected"
2020

2121
check "Build and run example project" \
22-
dotnet run --project projects/netcoreapp3.1
22+
dotnet run --project projects/net8.0
2323

2424
# Report results
2525
# If any of the checks above exited with a non-zero exit code, the test will fail.

test/dotnet/install_dotnet_specific_release_and_feature_band.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ source dev-container-features-test-lib
1313
source dotnet_env.sh
1414
source dotnet_helpers.sh
1515

16-
check ".NET SDK 5.0.3xx installed" \
17-
is_dotnet_sdk_version_installed "5.0.3"
16+
check ".NET SDK 8.0.3xx installed" \
17+
is_dotnet_sdk_version_installed "8.0.3"
1818

1919
check "Build and run example project" \
20-
dotnet run --project projects/net5.0
20+
dotnet run --project projects/net8.0
2121

2222
# Report results
2323
# If any of the checks above exited with a non-zero exit code, the test will fail.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Newtonsoft.Json;
2+
3+
string json = """
4+
{
5+
"Name": "Inception",
6+
"ReleaseDate": "2010-07-08T00:00:00",
7+
"Genres": [
8+
"Action",
9+
"Thriller"
10+
]
11+
}
12+
""";
13+
14+
Movie? m = JsonConvert.DeserializeObject<Movie>(json);
15+
16+
if (m == default)
17+
{
18+
Console.WriteLine("Decoding failed!");
19+
}
20+
else
21+
{
22+
Console.WriteLine($"Movie name: {m.Name}");
23+
Console.WriteLine($"Release Date: {m.ReleaseDate}");
24+
Console.WriteLine($"Genres: {string.Join(", ", m.Genres)}");
25+
}
26+
27+
class Movie(string? name, DateTime releaseDate, List<string>? genres)
28+
{
29+
public string Name { get; set; } = name ?? "Default Name";
30+
public DateTime ReleaseDate { get; set; } = releaseDate;
31+
public List<string> Genres { get; set; } = genres ?? [];
32+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
12+
</ItemGroup>
13+
14+
</Project>

test/dotnet/scenarios.json

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
}
1010
},
1111
"install_dotnet_specific_release": {
12-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04",
12+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
1313
"remoteUser": "vscode",
1414
"features": {
1515
"dotnet": {
16-
"version": "3.1"
16+
"version": "8.0"
1717
}
1818
}
1919
},
2020
"install_dotnet_specific_release_and_feature_band": {
21-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04",
21+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
2222
"remoteUser": "vscode",
2323
"features": {
2424
"dotnet": {
25-
"version": "5.0.3xx"
25+
"version": "8.0.3xx"
2626
}
2727
}
2828
},
@@ -40,17 +40,29 @@
4040
"remoteUser": "vscode",
4141
"features": {
4242
"dotnet": {
43-
"version": "9.0",
43+
"version": "10.0-preview",
4444
"additionalVersions": [
45+
"9.0",
4546
"8.0",
46-
"7.0",
47-
"6.0",
48-
"5.0",
49-
"3.1"
47+
"7.0"
5048
]
5149
}
5250
}
5351
},
52+
"install_dotnet_multiple_versions_preview": {
53+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
54+
"remoteUser": "vscode",
55+
"features": {
56+
"dotnet": {
57+
"version": "9.0",
58+
"additionalVersions": [
59+
"10.0-preview",
60+
"8.0",
61+
"7.0"
62+
]
63+
}
64+
}
65+
},
5466
"install_dotnet_global_tool": {
5567
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
5668
"remoteUser": "vscode",

0 commit comments

Comments
 (0)