Skip to content

Commit

Permalink
Update to .NET Core 3.1 (#13)
Browse files Browse the repository at this point in the history
* Update to .NET Core 3.1
  • Loading branch information
henkmollema authored Feb 21, 2020
1 parent 9b85f7a commit 513b063
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: csharp
mono: none
dotnet: 3.0
dotnet: 3.1
dist: xenial
env:
global:
Expand All @@ -18,5 +18,5 @@ matrix:
- os: linux
dist: xenial
- os: osx
dotnet: 3.0.100
dotnet: 3.1.102
osx_image: xcode11.2
12 changes: 0 additions & 12 deletions src/StartupModules/ConfigureMiddlewareContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ public class ConfigureMiddlewareContext
/// <summary>
/// Initializes a new instance of the <see cref="ConfigureServicesContext"/> class.
/// </summary>
#if NETSTANDARD2_0
public ConfigureMiddlewareContext(IConfiguration configuration, IHostingEnvironment hostingEnvironment, IServiceProvider serviceProvider)
#elif NETCOREAPP3_0
public ConfigureMiddlewareContext(IConfiguration configuration, IWebHostEnvironment hostingEnvironment, IServiceProvider serviceProvider)
#endif
{
Configuration = configuration;
HostingEnvironment = hostingEnvironment;
Expand All @@ -28,18 +24,10 @@ public ConfigureMiddlewareContext(IConfiguration configuration, IWebHostEnvironm
/// </summary>
public IConfiguration Configuration { get; }

#if NETSTANDARD2_0
/// <summary>
/// Gets the application <see cref="IHostingEnvironment"/> instance.
/// </summary>
public IHostingEnvironment HostingEnvironment { get; set; }
#elif NETCOREAPP3_0

/// <summary>
/// Gets the application <see cref="IWebHostEnvironment"/> instance.
/// </summary>
public IWebHostEnvironment HostingEnvironment { get; }
#endif

/// <summary>
/// Gets the <see cref="IServiceProvider"/> instance scoped for the lifetime of application startup.
Expand Down
12 changes: 0 additions & 12 deletions src/StartupModules/ConfigureServicesContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ public class ConfigureServicesContext
/// <summary>
/// Initializes a new instance of the <see cref="ConfigureServicesContext"/> class.
/// </summary>
#if NETSTANDARD2_0
public ConfigureServicesContext(IConfiguration configuration, IHostingEnvironment hostingEnvironment)
#elif NETCOREAPP3_0
public ConfigureServicesContext(IConfiguration configuration, IWebHostEnvironment hostingEnvironment)
#endif
{
Configuration = configuration;
HostingEnvironment = hostingEnvironment;
Expand All @@ -26,17 +22,9 @@ public ConfigureServicesContext(IConfiguration configuration, IWebHostEnvironmen
/// </summary>
public IConfiguration Configuration { get; }

#if NETSTANDARD2_0
/// <summary>
/// Gets the application <see cref="IHostingEnvironment"/> instance.
/// </summary>
public IHostingEnvironment HostingEnvironment { get; set; }
#elif NETCOREAPP3_0

/// <summary>
/// Gets the application <see cref="IWebHostEnvironment"/> instance.
/// </summary>
public IWebHostEnvironment HostingEnvironment { get; }
#endif
}
}
8 changes: 0 additions & 8 deletions src/StartupModules/Internal/ModulesStartupFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ public class ModulesStartupFilter : IStartupFilter
{
private readonly StartupModuleRunner _runner;
private readonly IConfiguration _configuration;
#if NETSTANDARD2_0
private readonly IHostingEnvironment _hostingEnvironment;
#elif NETCOREAPP3_0
private readonly IWebHostEnvironment _hostingEnvironment;
#endif

/// <summary>
/// Initializes a new instance of the <see cref="ModulesStartupFilter"/> class.
/// </summary>
#if NETSTANDARD2_0
public ModulesStartupFilter(StartupModuleRunner runner, IConfiguration configuration, IHostingEnvironment hostingEnvironment)
#elif NETCOREAPP3_0
public ModulesStartupFilter(StartupModuleRunner runner, IConfiguration configuration, IWebHostEnvironment hostingEnvironment)
#endif
{
_runner = runner;
_configuration = configuration;
Expand Down
10 changes: 1 addition & 9 deletions src/StartupModules/StartupModuleRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ public StartupModuleRunner(StartupModulesOptions options)
/// Calls <see cref="IStartupModule.ConfigureServices(IServiceCollection, ConfigureServicesContext)"/> on the
/// discoverd <see cref="IStartupModule"/>'s.
/// </summary>
#if NETSTANDARD2_0
public void ConfigureServices(IServiceCollection services, IConfiguration configuration, IHostingEnvironment hostingEnvironment)
#elif NETCOREAPP3_0
public void ConfigureServices(IServiceCollection services, IConfiguration configuration, IWebHostEnvironment hostingEnvironment)
#endif
{
var ctx = new ConfigureServicesContext(configuration, hostingEnvironment);

Expand All @@ -43,14 +39,10 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
}

/// <summary>
/// Calls <see cref="IStartupModule.Configure(IApplicationBuilder, ConfigureMiddlewareContext)"/> on the
/// Calls <see cref="IStartupModule.Configure(IApplicationBuilder, ConfigureMiddlewareContext)"/> on the
/// discovered <see cref="IStartupModule"/>.
/// </summary>
#if NETSTANDARD2_0
public void Configure(IApplicationBuilder app, IConfiguration configuration, IHostingEnvironment hostingEnvironment)
#elif NETCOREAPP3_0
public void Configure(IApplicationBuilder app, IConfiguration configuration, IWebHostEnvironment hostingEnvironment)
#endif
{
using var scope = app.ApplicationServices.CreateScope();
var ctx = new ConfigureMiddlewareContext(configuration, hostingEnvironment, scope.ServiceProvider);
Expand Down
14 changes: 4 additions & 10 deletions src/StartupModules/StartupModules.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<TargetFrameworks>netcoreapp3.0;netstandard2.0</TargetFrameworks>
<VersionPrefix>3.0.0</VersionPrefix>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<Authors>Henk Mollema</Authors>
<Description>Startup modules for ASP.NET Core.</Description>
<Copyright>Copyright © Henk Mollema 2019</Copyright>
<Copyright>Copyright © Henk Mollema 2020</Copyright>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;startup;dependency injection;modules;modular</PackageTags>
<PackageProjectUrl>https://github.com/henkmollema/StartupModules</PackageProjectUrl>
Expand All @@ -15,13 +15,7 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions test/StartupModules.Tests/StartupModules.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand All @@ -10,10 +10,10 @@
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
reportgenerator -reports:coverage.opencover.xml
-->
<PackageReference Include="coverlet.msbuild" Version="2.6.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="coverlet.msbuild" Version="2.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions test/TestWebApp/TestWebApp.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\StartupModules\StartupModules.csproj" />
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
<PackageReference Include="Webenable.Hangfire.Contrib" Version="2.2.0" />
<PackageReference Include="Webenable.Hangfire.Contrib" Version="2.3.0" />
</ItemGroup>
</Project>

0 comments on commit 513b063

Please sign in to comment.