Unverified Commit a58d0f15 authored by Kaniska's avatar Kaniska Committed by GitHub

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: 's avatarÁlvaro Rausell Guiard <33221237+AlvaroRausell@users.noreply.github.com>
parent 149d3031
{
"id": "dotnet",
"version": "2.2.1",
"version": "2.3.0",
"name": "Dotnet CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
"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 @@
"latest",
"lts",
"none",
"10.0-preview",
"8.0",
"7.0",
"6.0"
......
......@@ -108,7 +108,9 @@ done
check_packages wget ca-certificates icu-devtools
for version in "${versions[@]}"; do
install_sdk "$version"
# Remove '-preview' from version if suffixed with the version label
clean_version="$(echo "$version" | sed 's/-preview$//')"
install_sdk "$clean_version"
done
for version in "${dotnetRuntimeVersions[@]}"; do
......
......@@ -23,5 +23,6 @@ dotnet-install.sh [--version latest] --channel 6.0 [--quality GA]
dotnet-install.sh [--version latest] --channel 6.0.4xx [--quality GA]
dotnet-install.sh [--version latest] --channel 8.0 --quality preview
dotnet-install.sh [--version latest] --channel 8.0 --quality daily
dotnet-install.sh [--version latest] --channel 10.0 --quality preview
dotnet-install.sh --version 6.0.413
```
\ No newline at end of file
......@@ -22,14 +22,8 @@ is_dotnet_sdk_version_installed "8.0"
check ".NET SDK 7.0 installed" \
is_dotnet_sdk_version_installed "7.0"
check ".NET SDK 6.0 installed" \
is_dotnet_sdk_version_installed "6.0"
check ".NET SDK 5.0 installed" \
is_dotnet_sdk_version_installed "5.0"
check ".NET Core SDK 3.1 installed" \
is_dotnet_sdk_version_installed "3.1"
check ".NET SDK 10.0 installed" \
is_dotnet_sdk_version_installed "10.0"
check "Build example class library" \
dotnet build projects/multitargeting
......@@ -43,14 +37,8 @@ dotnet run --project projects/net8.0
check "Build and run .NET 7.0 project" \
dotnet run --project projects/net7.0
check "Build and run .NET 6.0 project" \
dotnet run --project projects/net6.0
check "Build and run .NET 5.0 project" \
dotnet run --project projects/net5.0
check "Build and run .NET Core 3.1 project" \
dotnet run --project projects/netcoreapp3.1
check "Build and run .NET 10.0 project" \
dotnet run --project projects/net10.0
# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
......
#!/bin/bash
set -e
# Optional: Import test library bundled with the devcontainer CLI
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
# Provides the 'check' and 'reportResults' commands.
source dev-container-features-test-lib
# Feature-specific tests
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
# check <LABEL> <cmd> [args...]
source dotnet_env.sh
source dotnet_helpers.sh
check ".NET SDK 9.0 installed" \
is_dotnet_sdk_version_installed "9.0"
check ".NET SDK 8.0 installed" \
is_dotnet_sdk_version_installed "8.0"
check ".NET SDK 7.0 installed" \
is_dotnet_sdk_version_installed "7.0"
check ".NET SDK 10.0 installed" \
is_dotnet_sdk_version_installed "10.0"
check "Build example class library" \
dotnet build projects/multitargeting
check "Build and run .NET 9.0 project" \
dotnet run --project projects/net9.0
check "Build and run .NET 8.0 project" \
dotnet run --project projects/net8.0
check "Build and run .NET 7.0 project" \
dotnet run --project projects/net7.0
check "Build and run .NET 10.0 project" \
dotnet run --project projects/net10.0
# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
reportResults
......@@ -13,13 +13,13 @@ source dev-container-features-test-lib
source dotnet_env.sh
source dotnet_helpers.sh
expected=$(fetch_latest_version_in_channel "3.1")
expected=$(fetch_latest_version_in_channel "8.0")
check ".NET Core SDK 3.1 installed" \
check ".NET Core SDK 8.0 installed" \
is_dotnet_sdk_version_installed "$expected"
check "Build and run example project" \
dotnet run --project projects/netcoreapp3.1
dotnet run --project projects/net8.0
# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
......
......@@ -13,11 +13,11 @@ source dev-container-features-test-lib
source dotnet_env.sh
source dotnet_helpers.sh
check ".NET SDK 5.0.3xx installed" \
is_dotnet_sdk_version_installed "5.0.3"
check ".NET SDK 8.0.3xx installed" \
is_dotnet_sdk_version_installed "8.0.3"
check "Build and run example project" \
dotnet run --project projects/net5.0
dotnet run --project projects/net8.0
# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
......
using Newtonsoft.Json;
string json = """
{
"Name": "Inception",
"ReleaseDate": "2010-07-08T00:00:00",
"Genres": [
"Action",
"Thriller"
]
}
""";
Movie? m = JsonConvert.DeserializeObject<Movie>(json);
if (m == default)
{
Console.WriteLine("Decoding failed!");
}
else
{
Console.WriteLine($"Movie name: {m.Name}");
Console.WriteLine($"Release Date: {m.ReleaseDate}");
Console.WriteLine($"Genres: {string.Join(", ", m.Genres)}");
}
class Movie(string? name, DateTime releaseDate, List<string>? genres)
{
public string Name { get; set; } = name ?? "Default Name";
public DateTime ReleaseDate { get; set; } = releaseDate;
public List<string> Genres { get; set; } = genres ?? [];
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -9,20 +9,20 @@
}
},
"install_dotnet_specific_release": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"remoteUser": "vscode",
"features": {
"dotnet": {
"version": "3.1"
"version": "8.0"
}
}
},
"install_dotnet_specific_release_and_feature_band": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"remoteUser": "vscode",
"features": {
"dotnet": {
"version": "5.0.3xx"
"version": "8.0.3xx"
}
}
},
......@@ -36,17 +36,29 @@
}
},
"install_dotnet_multiple_versions": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"remoteUser": "vscode",
"features": {
"dotnet": {
"version": "10.0-preview",
"additionalVersions": [
"9.0",
"8.0",
"7.0"
]
}
}
},
"install_dotnet_multiple_versions_preview": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"remoteUser": "vscode",
"features": {
"dotnet": {
"version": "9.0",
"additionalVersions": [
"10.0-preview",
"8.0",
"7.0",
"6.0",
"5.0",
"3.1"
"7.0"
]
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment