From 96c1eea40fc97b471ba0b33fcc79273c7ce586c7 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 11 Sep 2023 20:16:24 +0200 Subject: Use dotnet-install.sh in .NET feature (#628) * Use dotnet-install.sh in .NET feature * Use latest.version files * Cleanup runtime args * Use latest.version files in tests as well * Improve tests, remove code duplication * Add stderr helper * Validate version inputs * Use suggested description Co-authored-by: Samruddhi Khandale * Shorter version description Co-authored-by: Samruddhi Khandale * Shorter version description Co-authored-by: Samruddhi Khandale * Clean up apt lists * Verify 7.0 is latest * Fix PATH, add test for .NET global tools * Include a copy of dotnet-install.sh in the Feature * Configure useful env variables * Use stringly typed booleans * Keep imperative writing style in option hints * Update maintainers Co-authored-by: Samruddhi Khandale * Move dotnet-install.sh into a vendor directory * Refactor variables * Amend * Amend 2 * Use default options from devcontainer-feature.json * Add back variables * Fix shellchek warning in fetch_latest_sdk_version * Inline install_version function * Fix ShellCheck warnings * Improve CSV parsing * Default to latest when configuring an empty version * Add support for runtime-only configurations * Move 'none' check higher up * Deduplicate helper functions, sort into files * Address the user more directly in NOTES * Remove unnecessary defaults * Replace feature -> Feature Co-authored-by: Samruddhi Khandale * Add update-dotnet-install-script workflow * Apply suggestions from code review Co-authored-by: Samruddhi Khandale * Don't skip ci for automated script update --------- Co-authored-by: Samruddhi Khandale --- test/dotnet/projects/netcoreapp3.1/Program.cs | 39 ++++++++++++++++++++++ .../projects/netcoreapp3.1/example_project.csproj | 14 ++++++++ 2 files changed, 53 insertions(+) create mode 100644 test/dotnet/projects/netcoreapp3.1/Program.cs create mode 100644 test/dotnet/projects/netcoreapp3.1/example_project.csproj (limited to 'test/dotnet/projects/netcoreapp3.1') diff --git a/test/dotnet/projects/netcoreapp3.1/Program.cs b/test/dotnet/projects/netcoreapp3.1/Program.cs new file mode 100644 index 0000000..3e088a9 --- /dev/null +++ b/test/dotnet/projects/netcoreapp3.1/Program.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +class Program +{ + public static void Main() + { + string json = @"{ + ""Name"": ""Inception"", + ""ReleaseDate"": ""2010-07-08T00:00:00"", + ""Genres"": [ + ""Action"", + ""Thriller"" + ] + }"; + + Movie? m = JsonConvert.DeserializeObject(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 +{ + public string Name { get; set; } = "Default Name"; + public DateTime ReleaseDate { get; set; } + public List Genres { get; set; } = new List(); +} diff --git a/test/dotnet/projects/netcoreapp3.1/example_project.csproj b/test/dotnet/projects/netcoreapp3.1/example_project.csproj new file mode 100644 index 0000000..e2e909c --- /dev/null +++ b/test/dotnet/projects/netcoreapp3.1/example_project.csproj @@ -0,0 +1,14 @@ + + + + Exe + netcoreapp3.1 + enable + enable + + + + + + + \ No newline at end of file -- cgit v1.2.3