Skip to content

Upgrade React.Router to ASP.NET Core 2.0 #461

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 8, 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
1 change: 1 addition & 0 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ of patent rights can be found in the PATENTS file in the same directory.
<PackageAssemblies Include="React.MSBuild" />
<PackageAssemblies Include="React.Owin" />
<PackageAssemblies Include="React.Router" />
<PackageAssemblies Include="React.Router.Mvc4" />
<PackageAssemblies Include="React.Web" />
<PackageAssemblies Include="React.Web.Mvc4" />
<PackageAssemblies Include="System.Web.Optimization.React" />
Expand Down
47 changes: 47 additions & 0 deletions src/React.Router.Mvc4/React.Router.Mvc4.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>React Router support for ReactJS.NET.</Description>
<Copyright>Copyright 2014-Present Facebook, Inc</Copyright>
<AssemblyTitle>ReactJS.NET Router</AssemblyTitle>
<Authors>Daniel Lo Nigro, Gunnar Már Óttarsson</Authors>
<TargetFrameworks>net451</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>React.Router.Mvc4</AssemblyName>
<DefineConstants>$(DefineConstants);LEGACYASPNET</DefineConstants>
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>React.Router.Mvc4</PackageId>
<PackageTags>asp.net;mvc;asp;javascript;js;react;facebook;reactjs;babel;router;react router</PackageTags>
<PackageIconUrl>http://reactjs.net/img/logo_64.png</PackageIconUrl>
<PackageProjectUrl>http://reactjs.net/</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/reactjs/React.NET#licence</PackageLicenseUrl>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\React.Router\*.cs" />
<Compile Include="..\SharedAssemblyInfo.cs" />
<Compile Include="..\SharedAssemblyVersionInfo.cs" />
<Content Include="Content\**\*">
<Pack>true</Pack>
<PackagePath>content\</PackagePath>
</Content>
</ItemGroup>

<ItemGroup>
<Reference Include="System.Web" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="4.0.20710" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\React.Core\React.Core.csproj" />
</ItemGroup>

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

</Project>
7 changes: 2 additions & 5 deletions src/React.Router/HtmlHelperExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2014-Present, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -8,12 +8,9 @@
*/

using System;
using React.Exceptions;
using React.TinyIoC;

#if NET451
#if LEGACYASPNET
using System.Web;
using System.Web.Mvc;
using HttpResponse = System.Web.HttpResponseBase;
using IHtmlHelper = System.Web.Mvc.HtmlHelper;
#else
Expand Down
18 changes: 4 additions & 14 deletions src/React.Router/React.Router.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 Router</AssemblyTitle>
<Authors>Daniel Lo Nigro, Gunnar Már Óttarsson</Authors>
<TargetFrameworks>net451;netstandard1.6</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>React.Router</AssemblyName>
<AssemblyOriginatorKeyFile>../key.snk</AssemblyOriginatorKeyFile>
Expand All @@ -19,10 +19,6 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net451|AnyCPU'">
<DefineConstants>TRACE;DEBUG;ASPNETCORE;NET451</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs" />
<Compile Include="..\SharedAssemblyVersionInfo.cs" />
Expand All @@ -32,15 +28,9 @@
</Content>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="1.0.3" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Web" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="4.0.20710" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/React.Router/ReactRouterComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2014-Present, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -7,9 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

using JavaScriptEngineSwitcher.Core;
using Newtonsoft.Json;
using React.Exceptions;

namespace React.Router
{
Expand Down
6 changes: 3 additions & 3 deletions src/React.Router/ReactRouterException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2014-Present, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -15,7 +15,7 @@ namespace React.Router
/// <summary>
/// React Router Exception
/// </summary>
#if NET451
#if LEGACYASPNET
[Serializable]
#endif
public class ReactRouterException : Exception
Expand All @@ -38,7 +38,7 @@ public ReactRouterException(string message, Exception innerException)
: base(message, innerException) { }


#if NET451
#if LEGACYASPNET
/// <summary>
/// Used by deserialization
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions src/React.Router/SetServerResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2014-Present, Facebook, Inc.
* All rights reserved.
*
Expand All @@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#if NET451
#if LEGACYASPNET
using HttpResponse = System.Web.HttpResponseBase;
#else
using HttpResponse = Microsoft.AspNetCore.Http.HttpResponse;
Expand Down Expand Up @@ -45,7 +45,7 @@ public static void ModifyResponse(RoutingContext context, HttpResponse Response)
{
if (statusCode == 301)
{
#if NET451
#if LEGACYASPNET
Response.RedirectPermanent(context.url);
#else
Response.Redirect(context.url, true);
Expand Down
7 changes: 7 additions & 0 deletions src/React.sln
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "React.AspNet.Middleware", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "React.Sample.CoreMvc", "React.Sample.CoreMvc\React.Sample.CoreMvc.csproj", "{305918EF-AD05-4743-9B3A-DB1CE84D467E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "React.Router.Mvc4", "React.Router.Mvc4\React.Router.Mvc4.csproj", "{2170D912-86E9-4CE3-8DA4-E1DE8D958E63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -142,6 +144,10 @@ Global
{305918EF-AD05-4743-9B3A-DB1CE84D467E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{305918EF-AD05-4743-9B3A-DB1CE84D467E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{305918EF-AD05-4743-9B3A-DB1CE84D467E}.Release|Any CPU.Build.0 = Release|Any CPU
{2170D912-86E9-4CE3-8DA4-E1DE8D958E63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2170D912-86E9-4CE3-8DA4-E1DE8D958E63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2170D912-86E9-4CE3-8DA4-E1DE8D958E63}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2170D912-86E9-4CE3-8DA4-E1DE8D958E63}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -164,6 +170,7 @@ Global
{D076273B-C5EA-47C7-923D-523E4C5EE30D} = {681C45FB-103C-48BC-B992-20C5B6B78F92}
{7E1C3999-1982-476D-9307-12B30737B41E} = {681C45FB-103C-48BC-B992-20C5B6B78F92}
{305918EF-AD05-4743-9B3A-DB1CE84D467E} = {A51CE5B6-294F-4D39-B32B-BF08DAF9B40B}
{2170D912-86E9-4CE3-8DA4-E1DE8D958E63} = {681C45FB-103C-48BC-B992-20C5B6B78F92}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DCF4A41E-C60D-4086-98A9-6F8508D7E8D0}
Expand Down
2 changes: 1 addition & 1 deletion tests/React.Tests/React.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\React.Core\React.Core.csproj" />
<ProjectReference Include="..\..\src\React.Owin\React.Owin.csproj" />
<ProjectReference Include="..\..\src\React.Router\React.Router.csproj" />
<ProjectReference Include="..\..\src\React.Router.Mvc4\React.Router.Mvc4.csproj" />
<ProjectReference Include="..\..\src\React.Web.Mvc4\React.Web.Mvc4.csproj" />
</ItemGroup>

Expand Down