diff --git a/.azure/jobs/build-development.yml b/.azure/jobs/build-development.yml deleted file mode 100644 index 719e9fa..0000000 --- a/.azure/jobs/build-development.yml +++ /dev/null @@ -1,118 +0,0 @@ -jobs: - - job: BuildDotNet8_0 - displayName: 'Build preview (net8, build)' - timeoutInMinutes: 15 - strategy: - matrix: - Linux_Build_and_Test: - imageName: ${{ parameters.linuxVmImage }} - Windows_Build_Test_and_Package: - imageName: ${{ parameters.windowsVmImage }} - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: $(imageName) - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: $(imageName) - variables: - - name: DotnetBuildName - value: 'net8.0' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/download-snk.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/restore.yml - - template: ../steps/build-net.yml - parameters: - targetFramework: "net8.0" - - template: ../steps/publish-artifact.yml - parameters: - artifactName: "previewSrc" - - - job: BuildDotNet7_0 - displayName: 'Build preview (net7, build)' - timeoutInMinutes: 15 - strategy: - matrix: - Linux_Build_and_Test: - imageName: ${{ parameters.linuxVmImage }} - Windows_Build_Test_and_Package: - imageName: ${{ parameters.windowsVmImage }} - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: $(imageName) - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: $(imageName) - variables: - - name: DotnetBuildName - value: 'net7.0' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/download-snk.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/restore.yml - - template: ../steps/build-net.yml - parameters: - targetFramework: "net7.0" - - template: ../steps/publish-artifact.yml - parameters: - artifactName: "previewSrc" - - - job: BuildDotNet6_0 - displayName: 'Build preview (net6, build)' - timeoutInMinutes: 15 - strategy: - matrix: - Linux_Build_and_Test: - imageName: ${{ parameters.linuxVmImage }} - Windows_Build_Test_and_Package: - imageName: ${{ parameters.windowsVmImage }} - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: $(imageName) - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: $(imageName) - variables: - - name: DotnetBuildName - value: 'net6.0' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/download-snk.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/restore.yml - - template: ../steps/build-net.yml - parameters: - targetFramework: "net6.0" - - template: ../steps/publish-artifact.yml - parameters: - artifactName: "previewSrc" - - - job: PublishBuildArtifacts - condition: succeeded() - dependsOn: - - BuildDotNet8_0 - - BuildDotNet7_0 - - BuildDotNet6_0 - displayName: 'Store NuGet Packages for Preview' - timeoutInMinutes: 30 - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.windowsVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.windowsVmImage }} - variables: - - name: ArtifactPackageName - value: 'Preview' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/publish-nuget.yml - parameters: - artifactName: "previewSrc" - artifactPackages: - - "net8.0" - - "net7.0" - - "net6.0" \ No newline at end of file diff --git a/.azure/jobs/build-production.yml b/.azure/jobs/build-production.yml deleted file mode 100644 index d1220a1..0000000 --- a/.azure/jobs/build-production.yml +++ /dev/null @@ -1,100 +0,0 @@ -jobs: - - job: BuildDotNet8_0 - displayName: 'Build final (net8.0, build)' - timeoutInMinutes: 15 - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.windowsVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.windowsVmImage }} - variables: - - name: DotnetBuildName - value: 'net8.0' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/download-snk.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/restore.yml - - template: ../steps/build-net.yml - parameters: - targetFramework: "net8.0" - - template: ../steps/publish-artifact.yml - parameters: - artifactName: "productionSrc" - - - job: BuildDotNet7_0 - displayName: 'Build final (net7.0, build)' - timeoutInMinutes: 15 - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.windowsVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.windowsVmImage }} - variables: - - name: DotnetBuildName - value: 'net7.0' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/download-snk.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/restore.yml - - template: ../steps/build-net.yml - parameters: - targetFramework: "net7.0" - - template: ../steps/publish-artifact.yml - parameters: - artifactName: "productionSrc" - - - job: BuildDotNet6_0 - displayName: 'Build final (net6.0, build)' - timeoutInMinutes: 15 - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.windowsVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.windowsVmImage }} - variables: - - name: DotnetBuildName - value: 'net6.0' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/download-snk.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/restore.yml - - template: ../steps/build-net.yml - parameters: - targetFramework: "net6.0" - - template: ../steps/publish-artifact.yml - parameters: - artifactName: "productionSrc" - - - job: PublishBuildArtifacts - condition: succeeded() - dependsOn: - - BuildDotNet8_0 - - BuildDotNet7_0 - - BuildDotNet6_0 - displayName: 'Store NuGet Packages for Production' - timeoutInMinutes: 30 - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.windowsVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.windowsVmImage }} - variables: - - name: ArtifactPackageName - value: 'Production' - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/publish-nuget.yml - parameters: - artifactName: "productionSrc" - artifactPackages: - - "net8.0" - - "net7.0" - - "net6.0" \ No newline at end of file diff --git a/.azure/jobs/deployment-development.yml b/.azure/jobs/deployment-development.yml deleted file mode 100644 index fd17e8a..0000000 --- a/.azure/jobs/deployment-development.yml +++ /dev/null @@ -1,28 +0,0 @@ -jobs: - - deployment: CD - displayName: 'Preview: release to private NuGet Feed' - environment: 'Development' - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.linuxVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.linuxVmImage }} - strategy: - runOnce: - deploy: - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download the build artifacts' - inputs: - buildType: 'current' - downloadType: 'single' - artifactName: 'Preview' - downloadPath: '$(System.DefaultWorkingDirectory)' - - - task: NuGetCommand@2 - displayName: 'Publish NuGet Packages to https://nuget.codebelt.net/v3/index.json' - inputs: - command: push - packagesToPush: '$(System.DefaultWorkingDirectory)/**/*.nupkg;$(System.DefaultWorkingDirectory)/**/*.snupkg' - nuGetFeedType: external - publishFeedCredentials: 'Codebelt-Nuget' \ No newline at end of file diff --git a/.azure/jobs/deployment-production.yml b/.azure/jobs/deployment-production.yml deleted file mode 100644 index 664023e..0000000 --- a/.azure/jobs/deployment-production.yml +++ /dev/null @@ -1,31 +0,0 @@ -jobs: - - deployment: CD - displayName: 'Release to public NuGet Feed' - environment: 'Production' - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.linuxVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.linuxVmImage }} - strategy: - runOnce: - deploy: - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download the build artifacts' - inputs: - buildType: 'current' - downloadType: 'single' - artifactName: 'Production' - downloadPath: '$(System.DefaultWorkingDirectory)' - - - task: NuGetToolInstaller@1 - displayName: Install NuGet - inputs: - versionSpec: 6.8.0 - - - task: NuGetCommand@2 - displayName: 'Publish NuGet Packages to https://api.nuget.org/v3/index.json' - inputs: - command: custom - arguments: 'push $(System.DefaultWorkingDirectory)/**/*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey $(nuget-official-apikey) -SkipDuplicate' \ No newline at end of file diff --git a/.azure/jobs/finalization.yml b/.azure/jobs/finalization.yml deleted file mode 100644 index 238eadf..0000000 --- a/.azure/jobs/finalization.yml +++ /dev/null @@ -1,14 +0,0 @@ -jobs: - - job: Finalizer - displayName: 'Update BUILD_NUMBER (finalizer)' - timeoutInMinutes: 15 - pool: - ${{ if eq(parameters.selfHosted, 'true') }}: - name: ${{ parameters.linuxVmImage }} - ${{ if eq(parameters.selfHosted, 'false') }}: - vmImage: ${{ parameters.linuxVmImage }} - steps: - - template: ../steps/dotnet.yml - - template: ../steps/install-minvertool.yml - - template: ../steps/minverversion-override.yml - - template: ../steps/update-buildnumber.yml \ No newline at end of file diff --git a/.azure/pipelines.yml b/.azure/pipelines.yml deleted file mode 100644 index dd7b857..0000000 --- a/.azure/pipelines.yml +++ /dev/null @@ -1,48 +0,0 @@ -parameters: - - name: selfHosted - displayName: 'Use Self-Hosted Agents' - default: false - type: boolean - - name: linuxVmImage - displayName: 'Linux VM Image' - default: 'ubuntu-22.04' - type: string - values: - - 'ubuntu-20.04' - - 'ubuntu-22.04' - - name: windowsVmImage - displayName: 'Windows VM Image' - default: 'windows-2022' - type: string - values: - - 'windows-2019' - - 'windows-2022' - -name: $(DayOfYear)$(Rev:rr) - -trigger: - branches: - include: - - main - paths: - exclude: - - .azure - - .docfx - - .github - - .nuget - - LICENSE.md - - README.md - -variables: - - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE - value: true - - name: DOTNET_CLI_TELEMETRY_OPTOUT - value: 1 - -stages: - - ${{ if endsWith(variables['build.sourceBranch'], 'main') }}: - - template: stages/production.yml - parameters: - selfHosted: ${{ parameters.selfHosted }} - linuxVmImage: ${{ parameters.linuxVmImage }} - windowsVmImage: ${{ parameters.windowsVmImage }} \ No newline at end of file diff --git a/.azure/stages/production.yml b/.azure/stages/production.yml deleted file mode 100644 index 699e981..0000000 --- a/.azure/stages/production.yml +++ /dev/null @@ -1,71 +0,0 @@ -stages: - - stage: BuildDevelopment - displayName: 'Build for preview' - condition: and(succeeded(), endsWith(variables['build.sourceBranch'], 'main')) - variables: - - group: BuildSecrets - - name: BuildSource - value: 'src' - - name: BuildConfiguration - value: 'Debug' - jobs: - - template: ../jobs/build-development.yml - parameters: - selfHosted: ${{ parameters.selfHosted }} - linuxVmImage: ${{ parameters.linuxVmImage }} - windowsVmImage: ${{ parameters.windowsVmImage }} - - - stage: BuildMain - displayName: 'Build for production' - condition: and(succeeded(), endsWith(variables['build.sourceBranch'], 'main')) - variables: - - group: BuildSecrets - - name: BuildSource - value: 'src' - - name: BuildConfiguration - value: 'Release' - jobs: - - template: ../jobs/build-production.yml - parameters: - selfHosted: ${{ parameters.selfHosted }} - linuxVmImage: ${{ parameters.linuxVmImage }} - windowsVmImage: ${{ parameters.windowsVmImage }} - - - stage: UpdateBuildNumber - displayName: 'Updating BUILD_BUILDNUMBER for main branch' - condition: and(succeeded(), endsWith(variables['build.sourceBranch'], 'main')) - dependsOn: - - BuildDevelopment - - BuildMain - jobs: - - template: ../jobs/finalization.yml - parameters: - selfHosted: ${{ parameters.selfHosted }} - linuxVmImage: ${{ parameters.linuxVmImage }} - windowsVmImage: ${{ parameters.windowsVmImage }} - - - stage: DeployDevelopment - displayName: 'Deployment for development branch' - condition: and(succeeded(), endsWith(variables['build.sourceBranch'], 'main')) - dependsOn: UpdateBuildNumber - variables: - - group: BuildSecrets - jobs: - - template: ../jobs/deployment-development.yml - parameters: - selfHosted: ${{ parameters.selfHosted }} - linuxVmImage: ${{ parameters.linuxVmImage }} - windowsVmImage: ${{ parameters.windowsVmImage }} - - - stage: DeployMain - displayName: 'Deployment for main branch' - condition: and(succeeded(), endsWith(variables['build.sourceBranch'], 'main')) - dependsOn: UpdateBuildNumber - variables: - - group: BuildSecrets - jobs: - - template: ../jobs/deployment-production.yml - parameters: - selfHosted: ${{ parameters.selfHosted }} - linuxVmImage: ${{ parameters.linuxVmImage }} - windowsVmImage: ${{ parameters.windowsVmImage }} \ No newline at end of file diff --git a/.azure/steps/build-net.yml b/.azure/steps/build-net.yml deleted file mode 100644 index 13d8c6d..0000000 --- a/.azure/steps/build-net.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - - name: targetFramework - type: string - default: net8.0 - -steps: - - task: DotNetCoreCLI@2 - displayName: 'Build ${{ parameters.targetFramework }} compatible Assemblies' - inputs: - command: build - projects: | - src/**/*.csproj - arguments: '--configuration $(BuildConfiguration) --verbosity quiet --no-restore --framework ${{ parameters.targetFramework }}' - workingDirectory: '$(BuildSource)' \ No newline at end of file diff --git a/.azure/steps/codecov.yml b/.azure/steps/codecov.yml deleted file mode 100644 index 411f35a..0000000 --- a/.azure/steps/codecov.yml +++ /dev/null @@ -1,4 +0,0 @@ -steps: - - bash: bash <(curl -s https://codecov.io/bash) - condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - displayName: 'Upload to codecov.io' \ No newline at end of file diff --git a/.azure/steps/dotnet.yml b/.azure/steps/dotnet.yml deleted file mode 100644 index a916cde..0000000 --- a/.azure/steps/dotnet.yml +++ /dev/null @@ -1,5 +0,0 @@ -steps: - - task: UseDotNet@2 - displayName: 'Use .Net SDK 8.0.x' - inputs: - version: 8.0.x \ No newline at end of file diff --git a/.azure/steps/download-snk.yml b/.azure/steps/download-snk.yml deleted file mode 100644 index 75afe2b..0000000 --- a/.azure/steps/download-snk.yml +++ /dev/null @@ -1,12 +0,0 @@ -steps: - - task: DownloadSecureFile@1 - displayName: 'Download bootstrapper.snk' - inputs: - secureFile: 'bootstrapper.snk' - - - task: CopyFiles@2 - displayName: 'Copy bootstrapper.snk to $(System.DefaultWorkingDirectory)' - inputs: - SourceFolder: '$(Agent.TempDirectory)' - Contents: bootstrapper.snk - TargetFolder: '$(System.DefaultWorkingDirectory)' \ No newline at end of file diff --git a/.azure/steps/install-minvertool.yml b/.azure/steps/install-minvertool.yml deleted file mode 100644 index a336bb5..0000000 --- a/.azure/steps/install-minvertool.yml +++ /dev/null @@ -1,7 +0,0 @@ -steps: - - task: DotNetCoreCLI@2 - displayName: 'Install MinVer tool' - inputs: - command: custom - custom: tool - arguments: 'update --global minver-cli' \ No newline at end of file diff --git a/.azure/steps/install-reportgenerator.yml b/.azure/steps/install-reportgenerator.yml deleted file mode 100644 index 4ae0386..0000000 --- a/.azure/steps/install-reportgenerator.yml +++ /dev/null @@ -1,8 +0,0 @@ -steps: - - task: DotNetCoreCLI@2 - condition: eq(variables['Agent.OS'], 'Linux') - displayName: 'Install ReportGenerator tool' - inputs: - command: custom - custom: tool - arguments: update --global dotnet-reportgenerator-globaltool \ No newline at end of file diff --git a/.azure/steps/minverversion-override.yml b/.azure/steps/minverversion-override.yml deleted file mode 100644 index 6f3ffb1..0000000 --- a/.azure/steps/minverversion-override.yml +++ /dev/null @@ -1,14 +0,0 @@ -steps: - - script: | - export MINVERVERSIONOVERRIDE=$(minver) - echo $MINVERVERSIONOVERRIDE - echo "##vso[task.setvariable variable=MINVERVERSIONOVERRIDE;]$MINVERVERSIONOVERRIDE" - displayName: 'Set MINVERVERSIONOVERRIDE (for MinVer)' - condition: eq(variables['Agent.OS'], 'Linux') - - - script: | - minver > v.txt - set /p MINVERVERSIONOVERRIDE=$(MSBuildProjectName.EndsWith('Tests')) $(MSBuildProjectName.EndsWith('App')) true + false + latest - + true true - net8.0;net7.0;net6.0 + net8.0;net6.0 Copyright © Geekle 2021-2024. All rights reserved. gimlichael Geekle - Codebelt - Console Bootstrapper + Codebelt Bootstrapper icon.png README.md https://www.codebelt.net/ MIT - https://github.com/codebeltnet/classlib-bootstrapper + https://github.com/codebeltnet/bootstrapper git en-US true @@ -28,23 +30,23 @@ true snupkg true - true + true $(MSBuildThisFileDirectory)bootstrapper.snk - + - + - net8.0;net7.0;net6.0 + net8.0;net6.0 false false false @@ -55,23 +57,23 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Directory.Build.targets b/Directory.Build.targets index 3c3f8ab..b719a7f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,13 +1,4 @@  - - - <_LocalTopLevelSourceRoot Include="@(SourceRoot)" Condition="'%(SourceRoot.NestedRoot)' == ''"/> - - - ..\..\.nuget\$(MSBuildProjectName)\PackageReleaseNotes.txt @@ -27,4 +18,4 @@ $(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BUILD_BUILDNUMBER) - \ No newline at end of file + diff --git a/app/Codebelt.Bootstrapper.Web.App/Startup.cs b/app/Codebelt.Bootstrapper.Web.App/Startup.cs index 3009fb3..9107cf9 100644 --- a/app/Codebelt.Bootstrapper.Web.App/Startup.cs +++ b/app/Codebelt.Bootstrapper.Web.App/Startup.cs @@ -18,8 +18,10 @@ public override void ConfigureServices(IServiceCollection services) { } - public override void Configure(IApplicationBuilder app, ILogger logger) + public override void ConfigurePipeline(IApplicationBuilder app) { + var logger = app.ApplicationServices.GetRequiredService>(); + if (Environment.IsLocalDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/app/Codebelt.Bootstrapper.WebApi.App/Codebelt.Bootstrapper.WebApi.App.csproj b/app/Codebelt.Bootstrapper.WebApi.App/Codebelt.Bootstrapper.WebApi.App.csproj index 7ff39fc..741352e 100644 --- a/app/Codebelt.Bootstrapper.WebApi.App/Codebelt.Bootstrapper.WebApi.App.csproj +++ b/app/Codebelt.Bootstrapper.WebApi.App/Codebelt.Bootstrapper.WebApi.App.csproj @@ -1,7 +1,7 @@ - + diff --git a/app/Codebelt.Bootstrapper.WebApi.App/Startup.cs b/app/Codebelt.Bootstrapper.WebApi.App/Startup.cs index ed5152c..43760b7 100644 --- a/app/Codebelt.Bootstrapper.WebApi.App/Startup.cs +++ b/app/Codebelt.Bootstrapper.WebApi.App/Startup.cs @@ -24,8 +24,10 @@ public override void ConfigureServices(IServiceCollection services) }); } - public override void Configure(IApplicationBuilder app, ILogger logger) + public override void ConfigurePipeline(IApplicationBuilder app) { + var logger = app.ApplicationServices.GetRequiredService>(); + if (Environment.IsLocalDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/app/Codebelt.Bootstrapper.WebApp.App/Codebelt.Bootstrapper.WebApp.App.csproj b/app/Codebelt.Bootstrapper.WebApp.App/Codebelt.Bootstrapper.WebApp.App.csproj index 9a00f7a..01cec98 100644 --- a/app/Codebelt.Bootstrapper.WebApp.App/Codebelt.Bootstrapper.WebApp.App.csproj +++ b/app/Codebelt.Bootstrapper.WebApp.App/Codebelt.Bootstrapper.WebApp.App.csproj @@ -5,15 +5,11 @@ - - - - - + - + diff --git a/app/Codebelt.Bootstrapper.WebApp.App/Startup.cs b/app/Codebelt.Bootstrapper.WebApp.App/Startup.cs index ac98a78..f182645 100644 --- a/app/Codebelt.Bootstrapper.WebApp.App/Startup.cs +++ b/app/Codebelt.Bootstrapper.WebApp.App/Startup.cs @@ -19,8 +19,10 @@ public override void ConfigureServices(IServiceCollection services) services.AddRazorPages(); } - public override void Configure(IApplicationBuilder app, ILogger logger) + public override void ConfigurePipeline(IApplicationBuilder app) { + var logger = app.ApplicationServices.GetRequiredService>(); + if (Environment.IsLocalDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/app/Codebelt.Bootstrapper.WebMvc.App/Codebelt.Bootstrapper.WebMvc.App.csproj b/app/Codebelt.Bootstrapper.WebMvc.App/Codebelt.Bootstrapper.WebMvc.App.csproj index 9a00f7a..01cec98 100644 --- a/app/Codebelt.Bootstrapper.WebMvc.App/Codebelt.Bootstrapper.WebMvc.App.csproj +++ b/app/Codebelt.Bootstrapper.WebMvc.App/Codebelt.Bootstrapper.WebMvc.App.csproj @@ -5,15 +5,11 @@ - - - - - + - + diff --git a/app/Codebelt.Bootstrapper.WebMvc.App/Startup.cs b/app/Codebelt.Bootstrapper.WebMvc.App/Startup.cs index 828e559..f74d2a5 100644 --- a/app/Codebelt.Bootstrapper.WebMvc.App/Startup.cs +++ b/app/Codebelt.Bootstrapper.WebMvc.App/Startup.cs @@ -19,8 +19,10 @@ public override void ConfigureServices(IServiceCollection services) services.AddControllersWithViews(); } - public override void Configure(IApplicationBuilder app, ILogger logger) + public override void ConfigurePipeline(IApplicationBuilder app) { + var logger = app.ApplicationServices.GetRequiredService>(); + if (Environment.IsLocalDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/src/Codebelt.Bootstrapper.Web/Codebelt.Bootstrapper.Web.csproj b/src/Codebelt.Bootstrapper.Web/Codebelt.Bootstrapper.Web.csproj index d7a818b..85eb5da 100644 --- a/src/Codebelt.Bootstrapper.Web/Codebelt.Bootstrapper.Web.csproj +++ b/src/Codebelt.Bootstrapper.Web/Codebelt.Bootstrapper.Web.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Codebelt.Bootstrapper.Web/WebProgram.cs b/src/Codebelt.Bootstrapper.Web/WebProgram.cs index c42ee5e..f3286e6 100644 --- a/src/Codebelt.Bootstrapper.Web/WebProgram.cs +++ b/src/Codebelt.Bootstrapper.Web/WebProgram.cs @@ -1,8 +1,6 @@ using System; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; namespace Codebelt.Bootstrapper.Web { @@ -24,14 +22,6 @@ private static Func InitializeCreateHostBuilderCallback( .UseBootstrapperLifetime() .ConfigureWebHostDefaults(webBuilder => { - webBuilder.ConfigureServices(services => - { - var logger = services.BuildServiceProvider().GetService>(); - if (logger != null) - { - services.AddSingleton(logger); // we need a non-generic variant of the logger for WebStartup/Startup - } - }); webBuilder.UseStartup(); }); } diff --git a/src/Codebelt.Bootstrapper.Web/WebStartup.cs b/src/Codebelt.Bootstrapper.Web/WebStartup.cs index 4731cfa..e38ccc7 100644 --- a/src/Codebelt.Bootstrapper.Web/WebStartup.cs +++ b/src/Codebelt.Bootstrapper.Web/WebStartup.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; namespace Codebelt.Bootstrapper.Web { @@ -20,13 +20,17 @@ protected WebStartup(IConfiguration configuration, IHostEnvironment environment) { } - + /// + /// Configures the application pipeline. + /// + /// The for the application to configure. + public abstract void ConfigurePipeline(IApplicationBuilder app); /// - /// Configures the application. + /// Delegates the application pipeline configuration to . /// /// The for the application to configure. - /// The to write to. - public abstract void Configure(IApplicationBuilder app, ILogger logger); + /// This method is necessary as we rely on built-in convention based bootstrapping (>). + public void Configure(IApplicationBuilder app) => ConfigurePipeline(app); } } diff --git a/src/Codebelt.Bootstrapper/Codebelt.Bootstrapper.csproj b/src/Codebelt.Bootstrapper/Codebelt.Bootstrapper.csproj index 74a8b2c..aed97bf 100644 --- a/src/Codebelt.Bootstrapper/Codebelt.Bootstrapper.csproj +++ b/src/Codebelt.Bootstrapper/Codebelt.Bootstrapper.csproj @@ -6,9 +6,9 @@ - + - + diff --git a/src/Codebelt.Bootstrapper/StartupFactory.cs b/src/Codebelt.Bootstrapper/StartupFactory.cs index 0748126..c4e4462 100644 --- a/src/Codebelt.Bootstrapper/StartupFactory.cs +++ b/src/Codebelt.Bootstrapper/StartupFactory.cs @@ -38,7 +38,7 @@ public TStartup CreateInstance(out IServiceCollection services) where { var startup = (TStartup) Activator.CreateInstance(typeof(TStartup), _configuration, _environment); startup?.ConfigureServices(_services); - services =_services; + services = _services; return startup; } }