Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new CDN for dotnet builds #1230

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Improve dotnet tests
- add .net9.0 test case
- remove 'build and run' from scenarios with dynamic runtime versions because they fail when the version changes
sliekens committed Jan 7, 2025
commit 0950595bb9459c8af4d4d09f07820a31295c5be3
3 changes: 0 additions & 3 deletions test/dotnet/install_dotnet_latest_when_version_is_empty.sh
Original file line number Diff line number Diff line change
@@ -18,9 +18,6 @@ expected=$(fetch_latest_version)
check "Latest .NET SDK version installed" \
is_dotnet_sdk_version_installed "$expected"

check "Build and run example project" \
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.
reportResults
3 changes: 0 additions & 3 deletions test/dotnet/install_dotnet_lts.sh
Original file line number Diff line number Diff line change
@@ -18,9 +18,6 @@ expected=$(fetch_latest_version_in_channel "LTS")
check "Latest LTS version installed" \
is_dotnet_sdk_version_installed "$expected"

check "Build and run example project" \
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.
reportResults
27 changes: 27 additions & 0 deletions test/dotnet/install_dotnet_multiple_versions.sh
Original file line number Diff line number Diff line change
@@ -13,6 +13,9 @@ source dev-container-features-test-lib
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"

@@ -22,9 +25,33 @@ 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 "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 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

# Report results
# If any of the checks above exited with a non-zero exit code, the test will fail.
reportResults
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
2 changes: 1 addition & 1 deletion test/dotnet/projects/net5.0/example_project.csproj
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion test/dotnet/projects/net6.0/example_project.csproj
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion test/dotnet/projects/net7.0/example_project.csproj
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion test/dotnet/projects/net8.0/example_project.csproj
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
32 changes: 32 additions & 0 deletions test/dotnet/projects/net9.0/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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 ?? [];
}
14 changes: 14 additions & 0 deletions test/dotnet/projects/net9.0/example_project.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions test/dotnet/projects/netcoreapp3.1/example_project.csproj
Original file line number Diff line number Diff line change
@@ -3,12 +3,11 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

</Project>
9 changes: 6 additions & 3 deletions test/dotnet/scenarios.json
Original file line number Diff line number Diff line change
@@ -40,10 +40,13 @@
"remoteUser": "vscode",
"features": {
"dotnet": {
"version": "8.0.100-preview.6.23330.14",
"version": "9.0",
"additionalVersions": [
"8.0",
"7.0",
"6.0"
"6.0",
"5.0",
"3.1"
]
}
}
@@ -92,4 +95,4 @@
}
}
}
}
}
3 changes: 0 additions & 3 deletions test/dotnet/test.sh
Original file line number Diff line number Diff line change
@@ -24,9 +24,6 @@ expected=$(fetch_latest_version)
check "Latest .NET SDK version installed" \
is_dotnet_sdk_version_installed "$expected"

check "Build and run example project" \
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.
reportResults