Skip to content

Commit baa0bf5

Browse files
committed
Update libraries for .NET Core to 2.0 and for .NET Standard to 2.0
- Support for ASP.NET Core targeting .NET Framework to 4.6.1 - The use of .NET Standard 2.0 means .NET Framework is no longer required for React.AspNet and React.AspNet.Middleware
1 parent 5d1bd9d commit baa0bf5

File tree

8 files changed

+40
-52
lines changed

8 files changed

+40
-52
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "1.0.0"
3+
"version": "2.0.0"
44
},
55
"projects": [ "src", "test" ]
66
}

src/React.AspNet.Middleware/AssemblyRegistration.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2015, Facebook, Inc.
33
* All rights reserved.
44
*
@@ -24,11 +24,7 @@ public class AssemblyRegistration : IAssemblyRegistration
2424
public void Register(TinyIoCContainer container)
2525
{
2626
container.Register<IFileSystem, AspNetFileSystem>().AsSingleton();
27-
#if NET451
28-
container.Register<ICache, MemoryFileCache>().AsSingleton();
29-
#else
3027
container.Register<ICache, MemoryFileCacheCore>().AsSingleton();
31-
#endif
3228
}
3329
}
3430
}

src/React.AspNet.Middleware/MemoryFileCacheCore.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2016-Present, Facebook, Inc.
33
* All rights reserved.
44
*
@@ -7,7 +7,6 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10-
#if NETSTANDARD1_6
1110
using System;
1211
using System.Collections.Generic;
1312
using Microsoft.Extensions.Caching.Memory;
@@ -89,4 +88,3 @@ public void Set<T>(string key, T data, TimeSpan slidingExpiration, IEnumerable<s
8988
}
9089
}
9190
}
92-
#endif

src/React.AspNet.Middleware/React.AspNet.Middleware.csproj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Copyright>Copyright 2014-Present Facebook, Inc</Copyright>
66
<AssemblyTitle>ReactJS.NET - Babel middleware for ASP.NET Core</AssemblyTitle>
77
<Authors>Daniel Lo Nigro</Authors>
8-
<TargetFrameworks>net451;netstandard1.6</TargetFrameworks>
8+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<AssemblyName>React.AspNet.Middleware</AssemblyName>
1111
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
@@ -31,18 +31,19 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="1.1.2" />
35-
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
36-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.0" />
37-
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="1.1.1" />
34+
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
35+
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
36+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
37+
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="2.0.0" />
38+
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.0.0" />
3839
</ItemGroup>
39-
40-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
41-
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="1.1.1" />
42-
</ItemGroup>
43-
40+
4441
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
4542
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4643
</PropertyGroup>
44+
45+
<PropertyGroup>
46+
<NoWarn>7035</NoWarn>
47+
</PropertyGroup>
4748

4849
</Project>

src/React.AspNet/React.AspNet.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Copyright>Copyright 2014-Present Facebook, Inc</Copyright>
66
<AssemblyTitle>ReactJS.NET (ASP.NET Core MVC)</AssemblyTitle>
77
<Authors>Daniel Lo Nigro</Authors>
8-
<TargetFrameworks>net451;netstandard1.6</TargetFrameworks>
8+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<AssemblyName>React.AspNet</AssemblyName>
1111
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
@@ -31,11 +31,15 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="1.1.2" />
34+
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.0.0" />
3535
</ItemGroup>
3636

3737
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
3838
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3939
</PropertyGroup>
40+
41+
<PropertyGroup>
42+
<NoWarn>7035</NoWarn>
43+
</PropertyGroup>
4044

4145
</Project>

src/React.Sample.Mvc6/Program.cs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2015, Facebook, Inc.
33
* All rights reserved.
44
*
@@ -7,27 +7,22 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10-
using System;
11-
using System.Collections.Generic;
12-
using System.IO;
13-
using System.Linq;
14-
using System.Threading.Tasks;
10+
using Microsoft.AspNetCore;
1511
using Microsoft.AspNetCore.Hosting;
1612

13+
1714
namespace React.Sample.Mvc6
1815
{
1916
public class Program
2017
{
2118
public static void Main(string[] args)
2219
{
23-
var host = new WebHostBuilder()
24-
.UseKestrel()
25-
.UseContentRoot(Directory.GetCurrentDirectory())
26-
.UseIISIntegration()
20+
BuildWebHost(args).Run();
21+
}
22+
23+
public static IWebHost BuildWebHost(string[] args) =>
24+
WebHost.CreateDefaultBuilder(args)
2725
.UseStartup<Startup>()
2826
.Build();
29-
30-
host.Run();
31-
}
3227
}
3328
}

src/React.Sample.Mvc6/React.Sample.Mvc6.csproj

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net451;netcoreapp1.1</TargetFrameworks>
4+
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
55
<PreserveCompilationContext>true</PreserveCompilationContext>
66
<AssemblyName>React.Sample.Mvc6</AssemblyName>
77
<OutputType>Exe</OutputType>
88
<PackageId>React.Sample.Mvc6</PackageId>
99
<NoWarn>1701</NoWarn>
10-
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">1.1</RuntimeFrameworkVersion>
10+
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0</RuntimeFrameworkVersion>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
@@ -23,26 +23,16 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
27-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
28-
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
29-
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
30-
<PackageReference Include="Microsoft.NETCore.Platforms" Version="1.1.0" />
31-
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
32-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
33-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
34-
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
35-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
36-
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
26+
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
3727
</ItemGroup>
3828

39-
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
29+
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
4030
<PackageReference Include="JavaScriptEngineSwitcher.V8" Version="2.4.2" />
4131
<Reference Include="System" />
4232
<Reference Include="Microsoft.CSharp" />
4333
</ItemGroup>
4434

45-
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
35+
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
4636
<PackageReference Include="VroomJs" Version="1.2.3" />
4737
</ItemGroup>
4838

src/React.Sample.Mvc6/Startup.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 2015, Facebook, Inc.
33
* All rights reserved.
44
*
@@ -16,6 +16,7 @@
1616
using Newtonsoft.Json;
1717
using Newtonsoft.Json.Serialization;
1818
using React.AspNet;
19+
using System;
1920

2021
namespace React.Sample.Mvc6
2122
{
@@ -32,7 +33,7 @@ public Startup(IHostingEnvironment env)
3233
public IConfiguration Configuration { get; set; }
3334

3435
// This method gets called by the runtime.
35-
public void ConfigureServices(IServiceCollection services)
36+
public IServiceProvider ConfigureServices(IServiceCollection services)
3637
{
3738
// Add MVC services to the services container.
3839
services.AddMvc();
@@ -41,6 +42,9 @@ public void ConfigureServices(IServiceCollection services)
4142

4243
// Add ReactJS.NET services.
4344
services.AddReact();
45+
46+
// Build the intermediate service provider then return it
47+
return services.BuildServiceProvider();
4448
}
4549

4650
// Configure is called after ConfigureServices is called.

0 commit comments

Comments
 (0)