Skip to content

Commit

Permalink
cross-framework (netcore3.0 added); packages updated
Browse files Browse the repository at this point in the history
  • Loading branch information
justdmitry committed Nov 26, 2019
1 parent ccdabe4 commit 102465e
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 27 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: N{build}
configuration: Debug
image: Visual Studio 2017
image: Visual Studio 2019

before_build:
- cmd: dotnet restore
Expand Down
8 changes: 5 additions & 3 deletions sample/RecurrentTasks.Sample/RecurrentTasks.Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>RecurrentTasks.Sample</AssemblyName>
<OutputType>Exe</OutputType>
Expand All @@ -15,11 +15,13 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\RecurrentTasks\RecurrentTasks.csproj" />
</ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions sample/RecurrentTasks.Sample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@ public void ConfigureServices(IServiceCollection services)
// SampleTask expect this instance in .ctor(), we need to register it in DI
services.AddSingleton<SampleTaskRunHistory>();

#if NETCOREAPP2_1
services.AddMvc();
#else
services.AddControllersWithViews();
#endif
}

public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
#if NETCOREAPP2_1
app.UseMvcWithDefaultRoute();
#else
app.UseRouting();
app.UseEndpoints(c => c.MapDefaultControllerRoute());
#endif
}
}
}
18 changes: 12 additions & 6 deletions src/RecurrentTasks/RecurrentTasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Copyright>Dmitry Popov, 2016-2019</Copyright>
<AssemblyTitle>RecurrentTasks</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netcoreapp3.0</TargetFrameworks>
<AssemblyName>RecurrentTasks</AssemblyName>
<PackageId>RecurrentTasks</PackageId>
<PackageTags>task;job;recurrent;recurring;aspnetcore</PackageTags>
Expand All @@ -28,12 +28,18 @@
<Compile Include="..\..\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
30 changes: 19 additions & 11 deletions test/RecurrentTasks.Tests/RecurrentTasks.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<AssemblyName>RecurrentTasks.Tests</AssemblyName>
<PackageId>RecurrentTasks.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand All @@ -10,22 +10,30 @@
<Compile Include="..\..\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Codecov" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
<PackageReference Include="Codecov" Version="1.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="OpenCover" Version="4.7.922" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\RecurrentTasks\RecurrentTasks.csproj" />
</ItemGroup>
Expand Down
6 changes: 2 additions & 4 deletions test/RecurrentTasks.Tests/TaskRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ public class TaskRunnerTests : IDisposable

public TaskRunnerTests()
{
var lf = new LoggerFactory();
lf.AddConsole();

var serviceProvider = new ServiceCollection()
.AddLogging(lb => lb.AddConsole())
.AddTransient(_ => new SampleTask(settings))
.BuildServiceProvider();

var options = new TaskOptions<SampleTask>();
options.FirstRunDelay = TimeSpan.Zero;

sampleTask = new TaskRunner<SampleTask>(lf, options, serviceProvider.GetService<IServiceScopeFactory>());
sampleTask = new TaskRunner<SampleTask>(serviceProvider.GetService<ILoggerFactory>(), options, serviceProvider.GetService<IServiceScopeFactory>());
sampleTask.Options.Interval = TimeSpan.FromSeconds(5);
}

Expand Down
4 changes: 2 additions & 2 deletions testpublishreport.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# General configurations, such as location of the code coverage report, location of the OpenCover and location of .NET
$resultsFile = 'opencover-result.xml'
$openCoverConsole = $ENV:USERPROFILE + '\.nuget\packages\OpenCover\4.6.519\tools\OpenCover.Console.exe'
$codecovUploader = $ENV:USERPROFILE + '\.nuget\packages\codecov\1.1.0\tools\codecov.exe'
$openCoverConsole = $ENV:USERPROFILE + '\.nuget\packages\OpenCover\4.7.922\tools\OpenCover.Console.exe'
$codecovUploader = $ENV:USERPROFILE + '\.nuget\packages\codecov\1.9.0\tools\codecov.exe'
$target = '-target: C:\Program Files\dotnet\dotnet.exe'

# Configuration and execution of the tests
Expand Down

0 comments on commit 102465e

Please sign in to comment.