Skip to content

Update libraries for .NET Core to 2.0 and for .NET Standard to 2.0 #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "1.0.0"
"version": "2.0.0"
},
"projects": [ "src", "test" ]
}
6 changes: 1 addition & 5 deletions src/React.AspNet.Middleware/AssemblyRegistration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -24,11 +24,7 @@ public class AssemblyRegistration : IAssemblyRegistration
public void Register(TinyIoCContainer container)
{
container.Register<IFileSystem, AspNetFileSystem>().AsSingleton();
#if NET451
container.Register<ICache, MemoryFileCache>().AsSingleton();
#else
container.Register<ICache, MemoryFileCacheCore>().AsSingleton();
#endif
}
}
}
4 changes: 1 addition & 3 deletions src/React.AspNet.Middleware/MemoryFileCacheCore.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed on this line? Is it a Byte Order Mark?

* Copyright (c) 2016-Present, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -7,7 +7,6 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#if NETSTANDARD1_6
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Caching.Memory;
Expand Down Expand Up @@ -89,4 +88,3 @@ public void Set<T>(string key, T data, TimeSpan slidingExpiration, IEnumerable<s
}
}
}
#endif
21 changes: 11 additions & 10 deletions src/React.AspNet.Middleware/React.AspNet.Middleware.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Copyright>Copyright 2014-Present Facebook, Inc</Copyright>
<AssemblyTitle>ReactJS.NET - Babel middleware for ASP.NET Core</AssemblyTitle>
<Authors>Daniel Lo Nigro</Authors>
<TargetFrameworks>net451;netstandard1.6</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add target 451 or 461 too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote it on the pull request description, but with netstandard2.0 you do not requiere a different target if you use the library in a application targeting .NET Framework 4.6.1, that's the whole point of .NET Standard.

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>React.AspNet.Middleware</AssemblyName>
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
Expand All @@ -31,18 +31,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="2.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="1.1.1" />
</ItemGroup>


<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<NoWarn>7035</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The build script passes this in, but I guess the warning still appears when building in Visual Studio.

</PropertyGroup>

</Project>
8 changes: 6 additions & 2 deletions src/React.AspNet/React.AspNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Copyright>Copyright 2014-Present Facebook, Inc</Copyright>
<AssemblyTitle>ReactJS.NET (ASP.NET Core MVC)</AssemblyTitle>
<Authors>Daniel Lo Nigro</Authors>
<TargetFrameworks>net451;netstandard1.6</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>React.AspNet</AssemblyName>
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
Expand All @@ -31,11 +31,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.0.0" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<NoWarn>7035</NoWarn>
</PropertyGroup>

</Project>
21 changes: 8 additions & 13 deletions src/React.Sample.Mvc6/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -7,27 +7,22 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;


namespace React.Sample.Mvc6
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
BuildWebHost(args).Run();
}

public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();

host.Run();
}
}
}
27 changes: 11 additions & 16 deletions src/React.Sample.Mvc6/React.Sample.Mvc6.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net451;netcoreapp1.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>React.Sample.Mvc6</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>React.Sample.Mvc6</PackageId>
<NoWarn>1701</NoWarn>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">1.1</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0</RuntimeFrameworkVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -23,26 +23,21 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="JavaScriptEngineSwitcher.V8" Version="2.4.2" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="VroomJs" Version="1.2.3" />
</ItemGroup>

Expand Down
8 changes: 6 additions & 2 deletions src/React.Sample.Mvc6/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -16,6 +16,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using React.AspNet;
using System;

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

// This method gets called by the runtime.
public void ConfigureServices(IServiceCollection services)
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// Add MVC services to the services container.
services.AddMvc();
Expand All @@ -41,6 +42,9 @@ public void ConfigureServices(IServiceCollection services)

// Add ReactJS.NET services.
services.AddReact();

// Build the intermediate service provider then return it
return services.BuildServiceProvider();
}

// Configure is called after ConfigureServices is called.
Expand Down