From 3f32a8f3379227945160e7f941701c5e14f063e1 Mon Sep 17 00:00:00 2001 From: Travis Illig Date: Fri, 5 May 2023 08:22:34 -0700 Subject: [PATCH] Build update; remove net5.0 support. --- .editorconfig | 2 +- .vscode/settings.json | 10 ++- .vscode/tasks.json | 53 ++++++++---- Autofac.AspNetCore.Multitenant.sln | 2 +- appveyor.yml | 6 +- build.ps1 | 2 +- build/Analyzers.ruleset | 4 +- build/CodeAnalysisDictionary.xml | 47 ----------- build/Test.ruleset | 2 + .../Sandbox.AspNetCore3_To_3_1.csproj | 1 + .../Program.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/launchSettings.json | 0 .../Sandbox.AspNetCore5_To_7.csproj | 1 + .../Startup.cs | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 ....Integration.AspNetCore.Multitenant.csproj | 35 ++++---- .../Properties/Resources.Designer.cs | 82 ------------------- ...gration.AspNetCore.Multitenant.Test.csproj | 52 ++++++------ ...ltitenantRequestServicesMiddlewareTests.cs | 2 +- .../Specification/AssumedBehaviorTests.cs | 2 +- .../BuilderSpecificationTests.cs | 2 +- .../TestableTenantIdentificationStrategy.cs | 2 +- 24 files changed, 101 insertions(+), 206 deletions(-) delete mode 100644 build/CodeAnalysisDictionary.xml rename samples/{Sandbox.AspNetCore5_To_6 => Sandbox.AspNetCore5_To_7}/Program.cs (100%) rename samples/{Sandbox.AspNetCore5_To_6 => Sandbox.AspNetCore5_To_7}/Properties/AssemblyInfo.cs (100%) rename samples/{Sandbox.AspNetCore5_To_6 => Sandbox.AspNetCore5_To_7}/Properties/launchSettings.json (100%) rename samples/{Sandbox.AspNetCore5_To_6 => Sandbox.AspNetCore5_To_7}/Sandbox.AspNetCore5_To_7.csproj (94%) rename samples/{Sandbox.AspNetCore5_To_6 => Sandbox.AspNetCore5_To_7}/Startup.cs (100%) rename samples/{Sandbox.AspNetCore5_To_6 => Sandbox.AspNetCore5_To_7}/appsettings.Development.json (100%) rename samples/{Sandbox.AspNetCore5_To_6 => Sandbox.AspNetCore5_To_7}/appsettings.json (100%) delete mode 100644 src/Autofac.Integration.AspNetCore.Multitenant/Properties/Resources.Designer.cs diff --git a/.editorconfig b/.editorconfig index 9f1a417..836c1d7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -34,7 +34,7 @@ csharp_indent_switch_labels = true csharp_indent_labels = one_less_than_current ; Modifier preferences -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning ; Avoid this. unless absolutely necessary dotnet_style_qualification_for_field = false:suggestion diff --git a/.vscode/settings.json b/.vscode/settings.json index 1218cec..63f1ba0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,13 +2,21 @@ "cSpell.words": [ "autofac", "cref", + "inheritdoc", "langword", "multitenancy", "multitenant", "paramref", "seealso", + "typeparam", "xunit" ], "dotnet-test-explorer.runInParallel": true, - "dotnet-test-explorer.testProjectPath": "test/**/*.Test.csproj" + "dotnet-test-explorer.testProjectPath": "test/**/*Test.csproj", + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "*.resx": "$(capture).*.resx, $(capture).designer.cs, $(capture).designer.vb" + }, + "omnisharp.enableEditorConfigSupport": true, + "omnisharp.enableRoslynAnalyzers": true } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 4ae2342..fc8e283 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,19 +1,42 @@ { - "tasks": [{ - "args": [ - "build", - "${workspaceFolder}/Autofac.AspNetCore.Multitenant.sln", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "command": "dotnet", - "group": { - "isDefault": true, - "kind": "build" + "tasks": [ + { + "args": [ + "build", + "${workspaceFolder}/Autofac.AspNetCore.Multitenant.sln", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "command": "dotnet", + "group": { + "isDefault": true, + "kind": "build" + }, + "label": "build", + "presentation": { + "reveal": "silent" + }, + "problemMatcher": "$msCompile", + "type": "shell" }, - "label": "build", - "problemMatcher": "$msCompile", - "type": "process" - }], + { + "args": [ + "test", + "${workspaceFolder}/Autofac.AspNetCore.Multitenant.sln", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary", + "--filter", + "FullyQualifiedName!~Benchmark" + ], + "command": "dotnet", + "group": { + "isDefault": true, + "kind": "test" + }, + "label": "test", + "problemMatcher": "$msCompile", + "type": "process" + } + ], "version": "2.0.0" } diff --git a/Autofac.AspNetCore.Multitenant.sln b/Autofac.AspNetCore.Multitenant.sln index 236ce65..115179f 100644 --- a/Autofac.AspNetCore.Multitenant.sln +++ b/Autofac.AspNetCore.Multitenant.sln @@ -39,7 +39,7 @@ ProjectSection(SolutionItems) = preProject build\stylecop.json = build\stylecop.json EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.AspNetCore5_To_7", "samples\Sandbox.AspNetCore5_To_6\Sandbox.AspNetCore5_To_7.csproj", "{B64B6D62-AD07-49BE-AF65-3E4C92284AD5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.AspNetCore5_To_7", "samples\Sandbox.AspNetCore5_To_7\Sandbox.AspNetCore5_To_7.csproj", "{B64B6D62-AD07-49BE-AF65-3E4C92284AD5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/appveyor.yml b/appveyor.yml index e98d7c4..50d7063 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,9 @@ image: Ubuntu -version: 6.1.0.{build} - +version: 7.0.0.{build} dotnet_csproj: - version_prefix: "6.1.0" - + version_prefix: "7.0.0" patch: true file: 'src\**\*.csproj' diff --git a/build.ps1 b/build.ps1 index f4048cd..e60ae31 100644 --- a/build.ps1 +++ b/build.ps1 @@ -38,7 +38,7 @@ try { # Set version suffix $branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:APPVEYOR_REPO_BRANCH]; $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:APPVEYOR_BUILD_NUMBER]; - $versionSuffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)).Replace('/', '-').Replace('_', '-'))-$revision" }[$branch -eq "master" -and $revision -ne "local"] + $versionSuffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)).Replace('/', '-'))-$revision" }[$branch -eq "master" -and $revision -ne "local"] Write-Message "Package version suffix is '$versionSuffix'" diff --git a/build/Analyzers.ruleset b/build/Analyzers.ruleset index a783762..af01e57 100644 --- a/build/Analyzers.ruleset +++ b/build/Analyzers.ruleset @@ -22,9 +22,9 @@ + + - - diff --git a/build/CodeAnalysisDictionary.xml b/build/CodeAnalysisDictionary.xml deleted file mode 100644 index 0f1b469..0000000 --- a/build/CodeAnalysisDictionary.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - Api - Autofac - autowired - autowiring - composable - configurator - Ioc - Mef - Moq - multitenancy - Mvc - Mvx - Mvvm - startable - Owin - - - - - diff --git a/build/Test.ruleset b/build/Test.ruleset index da7807e..48b593a 100644 --- a/build/Test.ruleset +++ b/build/Test.ruleset @@ -38,6 +38,8 @@ + + diff --git a/samples/Sandbox.AspNetCore3_To_3_1/Sandbox.AspNetCore3_To_3_1.csproj b/samples/Sandbox.AspNetCore3_To_3_1/Sandbox.AspNetCore3_To_3_1.csproj index 925e9b0..d44968c 100644 --- a/samples/Sandbox.AspNetCore3_To_3_1/Sandbox.AspNetCore3_To_3_1.csproj +++ b/samples/Sandbox.AspNetCore3_To_3_1/Sandbox.AspNetCore3_To_3_1.csproj @@ -8,6 +8,7 @@ true true ../../build/Analyzers.ruleset + true AllEnabledByDefault diff --git a/samples/Sandbox.AspNetCore5_To_6/Program.cs b/samples/Sandbox.AspNetCore5_To_7/Program.cs similarity index 100% rename from samples/Sandbox.AspNetCore5_To_6/Program.cs rename to samples/Sandbox.AspNetCore5_To_7/Program.cs diff --git a/samples/Sandbox.AspNetCore5_To_6/Properties/AssemblyInfo.cs b/samples/Sandbox.AspNetCore5_To_7/Properties/AssemblyInfo.cs similarity index 100% rename from samples/Sandbox.AspNetCore5_To_6/Properties/AssemblyInfo.cs rename to samples/Sandbox.AspNetCore5_To_7/Properties/AssemblyInfo.cs diff --git a/samples/Sandbox.AspNetCore5_To_6/Properties/launchSettings.json b/samples/Sandbox.AspNetCore5_To_7/Properties/launchSettings.json similarity index 100% rename from samples/Sandbox.AspNetCore5_To_6/Properties/launchSettings.json rename to samples/Sandbox.AspNetCore5_To_7/Properties/launchSettings.json diff --git a/samples/Sandbox.AspNetCore5_To_6/Sandbox.AspNetCore5_To_7.csproj b/samples/Sandbox.AspNetCore5_To_7/Sandbox.AspNetCore5_To_7.csproj similarity index 94% rename from samples/Sandbox.AspNetCore5_To_6/Sandbox.AspNetCore5_To_7.csproj rename to samples/Sandbox.AspNetCore5_To_7/Sandbox.AspNetCore5_To_7.csproj index df0632c..5da1d63 100644 --- a/samples/Sandbox.AspNetCore5_To_6/Sandbox.AspNetCore5_To_7.csproj +++ b/samples/Sandbox.AspNetCore5_To_7/Sandbox.AspNetCore5_To_7.csproj @@ -8,6 +8,7 @@ true true ../../build/Analyzers.ruleset + true AllEnabledByDefault enable diff --git a/samples/Sandbox.AspNetCore5_To_6/Startup.cs b/samples/Sandbox.AspNetCore5_To_7/Startup.cs similarity index 100% rename from samples/Sandbox.AspNetCore5_To_6/Startup.cs rename to samples/Sandbox.AspNetCore5_To_7/Startup.cs diff --git a/samples/Sandbox.AspNetCore5_To_6/appsettings.Development.json b/samples/Sandbox.AspNetCore5_To_7/appsettings.Development.json similarity index 100% rename from samples/Sandbox.AspNetCore5_To_6/appsettings.Development.json rename to samples/Sandbox.AspNetCore5_To_7/appsettings.Development.json diff --git a/samples/Sandbox.AspNetCore5_To_6/appsettings.json b/samples/Sandbox.AspNetCore5_To_7/appsettings.json similarity index 100% rename from samples/Sandbox.AspNetCore5_To_6/appsettings.json rename to samples/Sandbox.AspNetCore5_To_7/appsettings.json diff --git a/src/Autofac.Integration.AspNetCore.Multitenant/Autofac.Integration.AspNetCore.Multitenant.csproj b/src/Autofac.Integration.AspNetCore.Multitenant/Autofac.Integration.AspNetCore.Multitenant.csproj index 55dfa67..2232f19 100644 --- a/src/Autofac.Integration.AspNetCore.Multitenant/Autofac.Integration.AspNetCore.Multitenant.csproj +++ b/src/Autofac.Integration.AspNetCore.Multitenant/Autofac.Integration.AspNetCore.Multitenant.csproj @@ -1,7 +1,6 @@  - ASP.NET Core support for multitenant DI via Autofac.Multitenant. 0.0.1 @@ -16,12 +15,13 @@ true en-US - net7.0;net6.0;net5.0;netcoreapp3.1 + net7.0;net6.0;netcoreapp3.1 latest enable true true ../../build/Analyzers.ruleset + true AllEnabledByDefault enable @@ -39,6 +39,8 @@ true true snupkg + + PrepareResources;$(CompileDependsOn) @@ -58,7 +60,7 @@ - + @@ -66,33 +68,26 @@ - - All - - - All - - All + all all - - - True - True - Resources.resx - - + + + MSBuild:Compile + CSharp + $(IntermediateOutputPath)%(Filename).Designer.cs + %(Filename) + + - ResXFileCodeGenerator - Resources.Designer.cs + Autofac.Integration.AspNetCore.Multitenant.Properties - diff --git a/src/Autofac.Integration.AspNetCore.Multitenant/Properties/Resources.Designer.cs b/src/Autofac.Integration.AspNetCore.Multitenant/Properties/Resources.Designer.cs deleted file mode 100644 index fc3ce23..0000000 --- a/src/Autofac.Integration.AspNetCore.Multitenant/Properties/Resources.Designer.cs +++ /dev/null @@ -1,82 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Autofac.Integration.AspNetCore.Multitenant.Properties { - using System; - using System.Reflection; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Autofac.Integration.AspNetCore.Multitenant.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to The multitenant container accessor didn't provide a multitenant container. Check your UseAutofacMultitenantRequestServices method call to ensure the container accessor is correctly set up.. - /// - internal static string NoMultitenantContainerAvailable { - get { - return ResourceManager.GetString("NoMultitenantContainerAvailable", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unable to find a RequestServicesFeature constructor that is supported.. - /// - internal static string NoSupportedRequestServicesConstructorFound { - get { - return ResourceManager.GetString("NoSupportedRequestServicesConstructorFound", resourceCulture); - } - } - } -} diff --git a/test/Autofac.Integration.AspNetCore.Multitenant.Test/Autofac.Integration.AspNetCore.Multitenant.Test.csproj b/test/Autofac.Integration.AspNetCore.Multitenant.Test/Autofac.Integration.AspNetCore.Multitenant.Test.csproj index 20e8506..aafde22 100644 --- a/test/Autofac.Integration.AspNetCore.Multitenant.Test/Autofac.Integration.AspNetCore.Multitenant.Test.csproj +++ b/test/Autofac.Integration.AspNetCore.Multitenant.Test/Autofac.Integration.AspNetCore.Multitenant.Test.csproj @@ -1,18 +1,25 @@  - net7.0;net6.0;net5.0;netcoreapp3.1; - $(NoWarn);CS1591;SA1600 + net7.0;net6.0;netcoreapp3.1; + $(NoWarn);CS1591 true ../../Autofac.snk true ../../build/Test.ruleset AllEnabledByDefault + true + false latest enable enable + + + + + @@ -28,17 +35,6 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - - all - - all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -47,31 +43,31 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - + + + + all + + + + all + runtime; build; native; contentfiles; analyzers + + - - - - - + + - + + diff --git a/test/Autofac.Integration.AspNetCore.Multitenant.Test/MultitenantRequestServicesMiddlewareTests.cs b/test/Autofac.Integration.AspNetCore.Multitenant.Test/MultitenantRequestServicesMiddlewareTests.cs index 5d50231..0523d41 100644 --- a/test/Autofac.Integration.AspNetCore.Multitenant.Test/MultitenantRequestServicesMiddlewareTests.cs +++ b/test/Autofac.Integration.AspNetCore.Multitenant.Test/MultitenantRequestServicesMiddlewareTests.cs @@ -90,7 +90,7 @@ private static DefaultHttpContext CreateContext() return context; } - private class TestHttpResponseFeature : HttpResponseFeature + private sealed class TestHttpResponseFeature : HttpResponseFeature { public override void OnCompleted(Func callback, object state) { diff --git a/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/AssumedBehaviorTests.cs b/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/AssumedBehaviorTests.cs index d6de5d6..7d5ba40 100644 --- a/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/AssumedBehaviorTests.cs +++ b/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/AssumedBehaviorTests.cs @@ -34,7 +34,7 @@ private static MultitenantContainer CreateContainer(IContainer container) return mtc; } - private class StaticTenantIdentificationStrategy : ITenantIdentificationStrategy + private sealed class StaticTenantIdentificationStrategy : ITenantIdentificationStrategy { public bool TryIdentifyTenant(out object tenantId) { diff --git a/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/BuilderSpecificationTests.cs b/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/BuilderSpecificationTests.cs index 494870d..8e1897c 100644 --- a/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/BuilderSpecificationTests.cs +++ b/test/Autofac.Integration.AspNetCore.Multitenant.Test/Specification/BuilderSpecificationTests.cs @@ -28,7 +28,7 @@ private static MultitenantContainer CreateContainer(IContainer container) return mtc; } - private class StaticTenantIdentificationStrategy : ITenantIdentificationStrategy + private sealed class StaticTenantIdentificationStrategy : ITenantIdentificationStrategy { public bool TryIdentifyTenant(out object tenantId) { diff --git a/test/Autofac.Integration.AspNetCore.Multitenant.Test/TestDependencies/TestableTenantIdentificationStrategy.cs b/test/Autofac.Integration.AspNetCore.Multitenant.Test/TestDependencies/TestableTenantIdentificationStrategy.cs index 84b2205..47b8acb 100644 --- a/test/Autofac.Integration.AspNetCore.Multitenant.Test/TestDependencies/TestableTenantIdentificationStrategy.cs +++ b/test/Autofac.Integration.AspNetCore.Multitenant.Test/TestDependencies/TestableTenantIdentificationStrategy.cs @@ -24,7 +24,7 @@ public bool TryIdentifyTenant(out object tenantId) return false; } - tenantId = tenantValues[0]; + tenantId = tenantValues[0]!; return true; } }