瀏覽代碼

Update to .NET 5

Lucas Trzesniewski 4 年之前
父節點
當前提交
d35a57734f

+ 2 - 2
.github/workflows/build.yml

@@ -3,8 +3,8 @@ name: Build
 on: [push, pull_request]
 
 env:
-  BUILD_DOTNET_VERSION: 3.1.x
-  BUILD_LINUX_TEST_TFM: netcoreapp3.1
+  BUILD_DOTNET_VERSION: 5.0.x
+  BUILD_LINUX_TEST_TFM: net5.0
   DOTNET_NOLOGO: 1
 
 jobs:

+ 1 - 1
build/build.cake

@@ -7,7 +7,7 @@ var target = Argument("target", "Default");
 var paths = new {
     src = MakeAbsolute(Directory("./../src")).FullPath,
     solution = MakeAbsolute(File("./../src/Abc.Zebus.sln")).FullPath,
-    nugetOutput = MakeAbsolute(Directory("./../output/nuget")).FullPath,
+    nugetOutput = MakeAbsolute(Directory("./../output")).FullPath,
 };
 
 //////////////////////////////////////////////////////////////////////

+ 1 - 1
src/Abc.Zebus.Directory.Cassandra.Tests/Abc.Zebus.Directory.Cassandra.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks>net48;net5.0</TargetFrameworks>
     <Version>$(ZebusDirectoryVersion)</Version>
   </PropertyGroup>
 

+ 1 - 1
src/Abc.Zebus.Directory.RocksDb.Tests/Abc.Zebus.Directory.RocksDb.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks>net48;net5.0</TargetFrameworks>
     <Platform>x64</Platform>
     <Platforms>AnyCPU;x64</Platforms>
   </PropertyGroup>

+ 1 - 1
src/Abc.Zebus.Directory.Runner/Abc.Zebus.Directory.Runner.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <TargetFramework>net5.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <Version>$(ZebusDirectoryVersion)</Version>
     <IsPackable>false</IsPackable>

+ 4 - 4
src/Abc.Zebus.Directory.Runner/Program.cs

@@ -40,17 +40,17 @@ namespace Abc.Zebus.Directory.Runner
             };
 
             XmlConfigurator.ConfigureAndWatch(LogManager.GetRepository(typeof(Program).Assembly), new FileInfo(PathUtil.InBaseDirectory("log4net.config")));
-            var storageType = ConfigurationManager.AppSettings["Storage"];
+            var storageType = ConfigurationManager.AppSettings["Storage"]!;
             _log.Info($"Starting in directory with storage type '{storageType}'");
 
             var busFactory = new BusFactory();
             InjectDirectoryServiceSpecificConfiguration(busFactory, Enum.Parse<StorageType>(storageType));
 
             busFactory
-                .WithConfiguration(new AppSettingsBusConfiguration(), ConfigurationManager.AppSettings["Environment"])
+                .WithConfiguration(new AppSettingsBusConfiguration(), ConfigurationManager.AppSettings["Environment"]!)
                 .WithScan()
-                .WithEndpoint(ConfigurationManager.AppSettings["Endpoint"])
-                .WithPeerId(ConfigurationManager.AppSettings["PeerId"]);
+                .WithEndpoint(ConfigurationManager.AppSettings["Endpoint"]!)
+                .WithPeerId(ConfigurationManager.AppSettings["PeerId"]!);
 
             using (busFactory.CreateAndStartBus())
             {

+ 1 - 1
src/Abc.Zebus.Directory.Tests/Abc.Zebus.Directory.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks>net48;net5.0</TargetFrameworks>
     <Version>$(ZebusDirectoryVersion)</Version>
   </PropertyGroup>
 

+ 1 - 1
src/Abc.Zebus.Persistence.CQL.Tests/Abc.Zebus.Persistence.CQL.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks>net48;net5.0</TargetFrameworks>
     <Version>$(ZebusPersistenceVersion)</Version>
   </PropertyGroup>
 

+ 1 - 1
src/Abc.Zebus.Persistence.RocksDb.Tests/Abc.Zebus.Persistence.RocksDb.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks>net48;net5.0</TargetFrameworks>
     <Version>$(ZebusPersistenceVersion)</Version>
     <Platform>x64</Platform>
     <Platforms>AnyCPU;x64</Platforms>

+ 1 - 1
src/Abc.Zebus.Persistence.Runner/Abc.Zebus.Persistence.Runner.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <TargetFramework>net5.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <Version>$(ZebusPersistenceVersion)</Version>
     <IsPackable>false</IsPackable>

+ 3 - 3
src/Abc.Zebus.Persistence.Runner/Program.cs

@@ -44,10 +44,10 @@ namespace Abc.Zebus.Persistence.Runner
 
             var appSettingsConfiguration = new AppSettingsConfiguration();
             var useCassandraStorage = ConfigurationManager.AppSettings["PersistenceStorage"] == "Cassandra";
-            var busFactory = new BusFactory().WithConfiguration(appSettingsConfiguration, ConfigurationManager.AppSettings["Environment"])
+            var busFactory = new BusFactory().WithConfiguration(appSettingsConfiguration, ConfigurationManager.AppSettings["Environment"]!)
                                              .WithScan()
-                                             .WithEndpoint(ConfigurationManager.AppSettings["Endpoint"])
-                                             .WithPeerId(ConfigurationManager.AppSettings["PeerId"]);
+                                             .WithEndpoint(ConfigurationManager.AppSettings["Endpoint"]!)
+                                             .WithPeerId(ConfigurationManager.AppSettings["PeerId"]!);
 
             InjectPersistenceServiceSpecificConfiguration(busFactory, appSettingsConfiguration, useCassandraStorage);
 

+ 1 - 1
src/Abc.Zebus.Persistence.Tests/Abc.Zebus.Persistence.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks>net48;net5.0</TargetFrameworks>
     <Version>$(ZebusPersistenceVersion)</Version>
   </PropertyGroup>
 

+ 3 - 3
src/Abc.Zebus.Testing/Integration/TestService.cs

@@ -55,7 +55,7 @@ namespace Abc.Zebus.Testing.Integration
                     RedirectStandardError = RedirectOutput,
                     CreateNoWindow = true,
                     Arguments = "-buildfile:" + Path.GetFileName(_buildFile) + " build-only -D:build.dir=\"" + _buildDirectory + "\"",
-                    WorkingDirectory = Path.GetDirectoryName(_buildFile),
+                    WorkingDirectory = Path.GetDirectoryName(_buildFile)!,
                 }
             };
 
@@ -103,12 +103,12 @@ namespace Abc.Zebus.Testing.Integration
                 _process.BeginOutputReadLine();
         }
 
-        private void LogError(string text)
+        private void LogError(string? text)
         {
             _errorWriter.WriteLine("[{0:HH:mm:ss.fff}][{1}Manager] {2}", DateTime.Now, _serviceName, text);
         }
 
-        private void LogInfo(string text)
+        private void LogInfo(string? text)
         {
             _outputWriter.WriteLine("[{0:HH:mm:ss.fff}][{1}Manager] {2}", DateTime.Now, _serviceName, text);
         }

+ 1 - 1
src/Abc.Zebus.Tests/Abc.Zebus.Tests.csproj

@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFrameworks>net48;netcoreapp3.1</TargetFrameworks>
+    <TargetFrameworks>net48;net5.0</TargetFrameworks>
     <Version>$(ZebusVersion)</Version>
     <IsTestProject>true</IsTestProject>
   </PropertyGroup>

+ 1 - 1
src/Abc.Zebus/DomainException.cs

@@ -61,7 +61,7 @@ namespace Abc.Zebus
             if (memberExpr == null)
                 return string.Empty;
 
-            var attr = (DescriptionAttribute)memberExpr.Member.GetCustomAttributes(typeof(DescriptionAttribute)).FirstOrDefault();
+            var attr = (DescriptionAttribute?)memberExpr.Member.GetCustomAttributes(typeof(DescriptionAttribute)).FirstOrDefault();
 
             return attr != null ? attr.Description : string.Empty;
         }

+ 1 - 1
src/Abc.Zebus/Subscription.cs

@@ -111,7 +111,7 @@ namespace Abc.Zebus
             using (CultureScope.Invariant())
             {
                 var newExpression = (NewExpression)factory.Body;
-                var parameters = newExpression.Constructor.GetParameters();
+                var parameters = newExpression.Constructor!.GetParameters();
 
                 for (var argumentIndex = 0; argumentIndex < newExpression.Arguments.Count; ++argumentIndex)
                 {

+ 1 - 1
src/Directory.Build.props

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
     <WarningLevel>4</WarningLevel>
-    <LangVersion>8.0</LangVersion>
+    <LangVersion>9.0</LangVersion>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <Prefer32Bit>false</Prefer32Bit>
     <DefaultItemExcludes>$(DefaultItemExcludes);*.DotSettings;*.ncrunchproject</DefaultItemExcludes>

+ 2 - 2
src/Directory.Build.targets

@@ -9,8 +9,8 @@
     <GenerateNullableAttributes>false</GenerateNullableAttributes>
   </PropertyGroup>
   <ItemGroup Condition="'$(Nullable)' == 'enable'">
-    <PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.154" PrivateAssets="all" />
-    <PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[3.1.0]" />
+    <PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />
+    <PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[5.0.0]" />
   </ItemGroup>
 
 </Project>