diff options
author | Steven <steven.liekens@gmail.com> | 2023-09-11 21:16:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-11 21:16:24 +0300 |
commit | 96c1eea40fc97b471ba0b33fcc79273c7ce586c7 (patch) | |
tree | 1ac35df447d38c00cb35e07a7b876dc985fc1329 /test/dotnet/projects | |
parent | 038bed3d58a84885da8a008b80905da17d57a543 (diff) |
Use dotnet-install.sh in .NET feature (#628)feature_dotnet_2.0.0
* 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 <samruddhikhandale@github.com>
* Shorter version description
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
* Shorter version description
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
* 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 <samruddhikhandale@github.com>
* 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 <samruddhikhandale@github.com>
* Add update-dotnet-install-script workflow
* Apply suggestions from code review
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
* Don't skip ci for automated script update
---------
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
Diffstat (limited to 'test/dotnet/projects')
-rw-r--r-- | test/dotnet/projects/.gitignore | 2 | ||||
-rw-r--r-- | test/dotnet/projects/multitargeting/Class1.cs | 4 | ||||
-rw-r--r-- | test/dotnet/projects/multitargeting/example_classlib.csproj | 9 | ||||
-rw-r--r-- | test/dotnet/projects/net5.0/Program.cs | 32 | ||||
-rw-r--r-- | test/dotnet/projects/net5.0/example_project.csproj | 13 | ||||
-rw-r--r-- | test/dotnet/projects/net6.0/Program.cs | 30 | ||||
-rw-r--r-- | test/dotnet/projects/net6.0/example_project.csproj | 14 | ||||
-rw-r--r-- | test/dotnet/projects/net7.0/Program.cs | 30 | ||||
-rw-r--r-- | test/dotnet/projects/net7.0/example_project.csproj | 14 | ||||
-rw-r--r-- | test/dotnet/projects/net8.0/Program.cs | 32 | ||||
-rw-r--r-- | test/dotnet/projects/net8.0/example_project.csproj | 14 | ||||
-rw-r--r-- | test/dotnet/projects/netcoreapp3.1/Program.cs | 39 | ||||
-rw-r--r-- | test/dotnet/projects/netcoreapp3.1/example_project.csproj | 14 |
13 files changed, 247 insertions, 0 deletions
diff --git a/test/dotnet/projects/.gitignore b/test/dotnet/projects/.gitignore new file mode 100644 index 0000000..8d4a6c0 --- /dev/null +++ b/test/dotnet/projects/.gitignore @@ -0,0 +1,2 @@ +bin +obj
\ No newline at end of file diff --git a/test/dotnet/projects/multitargeting/Class1.cs b/test/dotnet/projects/multitargeting/Class1.cs new file mode 100644 index 0000000..453b6a4 --- /dev/null +++ b/test/dotnet/projects/multitargeting/Class1.cs @@ -0,0 +1,4 @@ +public class Class1 +{ + +} diff --git a/test/dotnet/projects/multitargeting/example_classlib.csproj b/test/dotnet/projects/multitargeting/example_classlib.csproj new file mode 100644 index 0000000..ba47b0f --- /dev/null +++ b/test/dotnet/projects/multitargeting/example_classlib.csproj @@ -0,0 +1,9 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + +</Project> diff --git a/test/dotnet/projects/net5.0/Program.cs b/test/dotnet/projects/net5.0/Program.cs new file mode 100644 index 0000000..3f3144f --- /dev/null +++ b/test/dotnet/projects/net5.0/Program.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +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 +{ + public string Name { get; set; } = "Default Name"; + public DateTime ReleaseDate { get; set; } + public List<string> Genres { get; set; } = new List<string>(); +} diff --git a/test/dotnet/projects/net5.0/example_project.csproj b/test/dotnet/projects/net5.0/example_project.csproj new file mode 100644 index 0000000..63450c3 --- /dev/null +++ b/test/dotnet/projects/net5.0/example_project.csproj @@ -0,0 +1,13 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net5.0</TargetFramework> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + </ItemGroup> + +</Project>
\ No newline at end of file diff --git a/test/dotnet/projects/net6.0/Program.cs b/test/dotnet/projects/net6.0/Program.cs new file mode 100644 index 0000000..6d73112 --- /dev/null +++ b/test/dotnet/projects/net6.0/Program.cs @@ -0,0 +1,30 @@ +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 +{ + public string Name { get; set; } = "Default Name"; + public DateTime ReleaseDate { get; set; } + public List<string> Genres { get; set; } = new List<string>(); +} diff --git a/test/dotnet/projects/net6.0/example_project.csproj b/test/dotnet/projects/net6.0/example_project.csproj new file mode 100644 index 0000000..aa2434c --- /dev/null +++ b/test/dotnet/projects/net6.0/example_project.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net6.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + </ItemGroup> + +</Project>
\ No newline at end of file diff --git a/test/dotnet/projects/net7.0/Program.cs b/test/dotnet/projects/net7.0/Program.cs new file mode 100644 index 0000000..6d73112 --- /dev/null +++ b/test/dotnet/projects/net7.0/Program.cs @@ -0,0 +1,30 @@ +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 +{ + public string Name { get; set; } = "Default Name"; + public DateTime ReleaseDate { get; set; } + public List<string> Genres { get; set; } = new List<string>(); +} diff --git a/test/dotnet/projects/net7.0/example_project.csproj b/test/dotnet/projects/net7.0/example_project.csproj new file mode 100644 index 0000000..424f54a --- /dev/null +++ b/test/dotnet/projects/net7.0/example_project.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net7.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + </ItemGroup> + +</Project>
\ No newline at end of file diff --git a/test/dotnet/projects/net8.0/Program.cs b/test/dotnet/projects/net8.0/Program.cs new file mode 100644 index 0000000..690a54e --- /dev/null +++ b/test/dotnet/projects/net8.0/Program.cs @@ -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 +{ + public string Name { get; set; } = "Default Name"; + public DateTime ReleaseDate { get; set; } + public List<string> Genres { get; set; } = new List<string>(); +} diff --git a/test/dotnet/projects/net8.0/example_project.csproj b/test/dotnet/projects/net8.0/example_project.csproj new file mode 100644 index 0000000..2f1f608 --- /dev/null +++ b/test/dotnet/projects/net8.0/example_project.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + </ItemGroup> + +</Project>
\ No newline at end of file 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<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 +{ + public string Name { get; set; } = "Default Name"; + public DateTime ReleaseDate { get; set; } + public List<string> Genres { get; set; } = new List<string>(); +} 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 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp3.1</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + </ItemGroup> + +</Project>
\ No newline at end of file |