Skip to content

Commit 11bb8b1

Browse files
committed
Welcome .NET 5
1 parent b9c42ab commit 11bb8b1

File tree

9 files changed

+43
-54
lines changed

9 files changed

+43
-54
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: csharp
22
mono: none
33
dist: xenial
44
dotnet:
5-
- 3.1
5+
- 5.0
66
script:
77
- dotnet restore
88
- dotnet build

API/API.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<RootNamespace>TestMyCode.CSharp.API</RootNamespace>
66
<Nullable>enable</Nullable>
77
<AssemblyName>TestMyCode.CSharp.API</AssemblyName>
@@ -12,6 +12,6 @@
1212
<Authors>TestMyCode</Authors>
1313
<RepositoryUrl>https://github.com/TMC-CSharp/tmc-csharp-runner.git</RepositoryUrl>
1414
<RepositoryType>git</RepositoryType>
15-
<Version>1.0.0.1</Version>
15+
<Version>1.1</Version>
1616
</PropertyGroup>
1717
</Project>

Bootstrap/Bootstrap.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<TargetFramework>net5.0</TargetFramework>
66
<RootNamespace>TestMyCode.CSharp.Bootstrap</RootNamespace>
77
<Nullable>enable</Nullable>
88
<AssemblyName>TestMyCode.CSharp.Bootstrap</AssemblyName>
@@ -13,11 +13,11 @@
1313
<Authors>TestMyCode</Authors>
1414
<RepositoryUrl>https://github.com/TMC-CSharp/tmc-csharp-runner.git</RepositoryUrl>
1515
<RepositoryType>git</RepositoryType>
16-
<Version>1.0.0.1</Version>
16+
<Version>1.1</Version>
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20253.1" />
20+
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
2121
</ItemGroup>
2222

2323
<ItemGroup>

Bootstrap/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ private static RootCommand GenerateCommands()
133133
private static bool FindMsBuild()
134134
{
135135
string? msbuildPath = Environment.GetEnvironmentVariable("MSBUILD_EXE_PATH");
136-
if (!(msbuildPath is null))
136+
if (msbuildPath is not null)
137137
{
138138
return true;
139139
}
140140

141141
VisualStudioInstance? vsInstance = MSBuildLocator.QueryVisualStudioInstances(VisualStudioInstanceQueryOptions.Default)
142142
.FirstOrDefault(i => i.Version.Major == Environment.Version.Major && i.Version.Minor == Environment.Version.Minor);
143-
if (!(vsInstance is null))
143+
if (vsInstance is not null)
144144
{
145145
MSBuildLocator.RegisterInstance(vsInstance);
146146

@@ -158,10 +158,10 @@ private static void SetMsBuildDepsResolver()
158158

159159
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
160160
{
161-
AssemblyName name = new AssemblyName(args.Name!);
161+
AssemblyName name = new AssemblyName(args.Name);
162162

163163
string assemblyName = $"{name.Name}.dll";
164-
string sdkFileName = Path.Combine(msbuildDir!, assemblyName);
164+
string sdkFileName = Path.Combine(msbuildDir, assemblyName);
165165

166166
if (File.Exists(sdkFileName))
167167
{

Core/Core.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<RootNamespace>TestMyCode.CSharp.Core</RootNamespace>
66
<Nullable>enable</Nullable>
77
<AssemblyName>TestMyCode.CSharp.Core</AssemblyName>
@@ -12,11 +12,11 @@
1212
<Authors>TestMyCode</Authors>
1313
<RepositoryUrl>https://github.com/TMC-CSharp/tmc-csharp-runner.git</RepositoryUrl>
1414
<RepositoryType>git</RepositoryType>
15-
<Version>1.0.2</Version>
15+
<Version>1.1</Version>
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Microsoft.Build" Version="16.5.0">
19+
<PackageReference Include="Microsoft.Build" Version="16.8.0">
2020
<ExcludeAssets>runtime</ExcludeAssets>
2121
</PackageReference>
2222
<PackageReference Include="xunit.extensibility.core" Version="2.4.1" />

Core/Data/TestProjectData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ private void FindPoints(Assembly assembly)
8484
points = this._Points[fullName] = new HashSet<string>(0);
8585
}
8686

87-
if (!(typeAttribute is null))
87+
if (typeAttribute is not null)
8888
{
8989
points.Add(typeAttribute.Name);
9090
}
9191

92-
if (!(methodAttribute is null))
92+
if (methodAttribute is not null)
9393
{
9494
points.Add(methodAttribute.Name);
9595
}

Core/Extensions/BuildErrorEventArgsContext.cs

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,21 @@ internal static class BuildErrorEventArgsContext
99
{
1010
internal static string GetNoobFriendlyTip(this BuildErrorEventArgs @this)
1111
{
12-
switch (@this.Code)
13-
{
14-
case "CS0103":
15-
return "Did you name your classes incorrectly or forget to add correct imports?";
16-
case "CS1026":
17-
case "CS1513":
18-
return "Make sure all opening brackets have a corresponding closing bracket.";
19-
case "CS1003":
20-
return @this.Message.Contains("']'")
21-
? "Make sure all opening brackets have a corresponding closing bracket."
22-
: string.Empty;
23-
case "CS0116":
24-
return "Make sure your variables and methods are inside a class or struct.";
25-
case "CS0165":
26-
return "Make sure the variable is assigned a value.";
27-
case "CS0269":
28-
return "Make sure the parameter is assigned a value.";
29-
case "CS1001":
30-
return "Make sure your classes and variables have names.";
31-
case "CS1009":
32-
return "If you want to use the backslash (\\) character in a string, type '\\\\' instead or precede the string with '@'.";
33-
case "CS1061":
34-
return "Make sure the method or class member exists.";
35-
case "CS1501":
36-
case "CS1502":
37-
case "CS1503":
38-
return "Make sure your arguments match the method definition.";
39-
case "CS1729":
40-
return "Make sure your parameters match the constructor definition.";
41-
default:
42-
return string.Empty;
43-
};
12+
return @this.Code switch
13+
{
14+
"CS0103" => "Did you name your classes incorrectly or forget to add correct imports?",
15+
"CS1026" or "CS1513" => "Make sure all opening brackets have a corresponding closing bracket.",
16+
"CS1003" => @this.Message.Contains("']'") ? "Make sure all opening brackets have a corresponding closing bracket." : string.Empty,
17+
"CS0116" => "Make sure your variables and methods are inside a class or struct.",
18+
"CS0165" => "Make sure the variable is assigned a value.",
19+
"CS0269" => "Make sure the parameter is assigned a value.",
20+
"CS1001" => "Make sure your classes and variables have names.",
21+
"CS1009" => "If you want to use the backslash (\\) character in a string, type '\\\\' instead or precede the string with '@'.",
22+
"CS1061" => "Make sure the method or class member exists.",
23+
"CS1501" or "CS1502" or "CS1503" => "Make sure your arguments match the method definition.",
24+
"CS1729" => "Make sure your parameters match the constructor definition.",
25+
_ => string.Empty,
26+
};
4427
}
4528
}
4629
}

TestAssembly/TestAssembly.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<RootNamespace>TestMyCode.CSharp.TestAssembly</RootNamespace>
66
</PropertyGroup>
77

88
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
910
<PackageReference Include="xunit" Version="2.4.1" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
12+
<PrivateAssets>all</PrivateAssets>
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
</PackageReference>
1015
</ItemGroup>
1116

1217
<ItemGroup>

Tests/Tests.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<RootNamespace>TestMyCode.CSharp.Tests</RootNamespace>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="coverlet.collector" Version="1.2.1">
9+
<PackageReference Include="coverlet.collector" Version="1.3.0">
1010
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1111
<PrivateAssets>all</PrivateAssets>
1212
</PackageReference>
13-
<PackageReference Include="coverlet.msbuild" Version="2.8.1">
13+
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1515
<PrivateAssets>all</PrivateAssets>
1616
</PackageReference>
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
1718
<PackageReference Include="xunit" Version="2.4.1" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1920
<PrivateAssets>all</PrivateAssets>
2021
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2122
</PackageReference>

0 commit comments

Comments
 (0)