diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e331cbe19..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: '{build}' -os: Visual Studio 2017 -install: - - set PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\;%PATH% - - ps: Install-Product node 10 - - npm install --global npm -build: - project: build.proj - verbosity: normal -test_script: - - dotnet test --configuration Release --no-build tests/React.Tests/React.Tests.csproj -artifacts: - - path: output\*.nupkg diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f53288ced..2372786f1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,7 +2,7 @@ trigger: - master pool: - vmImage: 'VS2017-Win2016' + vmImage: 'windows-2019' variables: buildPlatform: 'Any CPU' @@ -15,6 +15,11 @@ steps: - script: npm install --global npm + - task: DotNetCoreInstaller@0 + inputs: + packageType: 'sdk' + version: '3.0.100-preview5-011568' + - task: VSBuild@1 inputs: solution: 'build.proj' diff --git a/global.json b/global.json index 9a66d5edc..d96e311f9 100644 --- a/global.json +++ b/global.json @@ -1,3 +1,6 @@ { - "projects": [ "src", "test" ] + "projects": [ "src", "test" ], + "sdk": { + "version": "3.0.100-preview" + } } diff --git a/runs-msbuild.bat b/runs-msbuild.bat index d56d5c22c..43ffa4287 100644 --- a/runs-msbuild.bat +++ b/runs-msbuild.bat @@ -4,9 +4,10 @@ set BUILDTYPE="%~1" set ACTION="%~2" for %%s in ( - "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" - "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" - "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" + "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" + "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" + "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" + "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe" ) do ( if exist %%s ( echo %%s build.proj %ACTION% %BUILDTYPE% diff --git a/src/React.AspNet.Middleware/AspNetFileSystem.cs b/src/React.AspNet.Middleware/AspNetFileSystem.cs index 76ef88306..dec4ab94c 100644 --- a/src/React.AspNet.Middleware/AspNetFileSystem.cs +++ b/src/React.AspNet.Middleware/AspNetFileSystem.cs @@ -8,6 +8,10 @@ using System.IO; using Microsoft.AspNetCore.Hosting; +#if NETCOREAPP2_0 || NETSTANDARD2_0 +using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; +#endif + namespace React.AspNet { /// @@ -16,13 +20,13 @@ namespace React.AspNet /// public class AspNetFileSystem : FileSystemBase { - private readonly IHostingEnvironment _hostingEnv; + private readonly IWebHostEnvironment _hostingEnv; /// /// Initializes a new instance of the class. /// - /// The ASP.NET 5 hosting environment - public AspNetFileSystem(IHostingEnvironment hostingEnv) + /// The .NET Core hosting environment + public AspNetFileSystem(IWebHostEnvironment hostingEnv) { _hostingEnv = hostingEnv; } diff --git a/src/React.AspNet.Middleware/BabelFileMiddleware.cs b/src/React.AspNet.Middleware/BabelFileMiddleware.cs index 1120c7c8e..06d127c43 100644 --- a/src/React.AspNet.Middleware/BabelFileMiddleware.cs +++ b/src/React.AspNet.Middleware/BabelFileMiddleware.cs @@ -15,6 +15,10 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +#if NETCOREAPP2_0 || NETSTANDARD2_0 +using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; +#endif + namespace React.AspNet { /// @@ -23,7 +27,7 @@ namespace React.AspNet public class BabelFileMiddleware { private readonly RequestDelegate _next; - private readonly IHostingEnvironment _hostingEnv; + private readonly IWebHostEnvironment _hostingEnv; private readonly ILoggerFactory _loggerFactory; private readonly BabelFileOptions _options; @@ -34,7 +38,7 @@ public class BabelFileMiddleware /// The configuration options. /// The hosting environment. /// An instance used to create loggers. - public BabelFileMiddleware(RequestDelegate next, BabelFileOptions options, IHostingEnvironment hostingEnv, ILoggerFactory loggerFactory) + public BabelFileMiddleware(RequestDelegate next, BabelFileOptions options, IWebHostEnvironment hostingEnv, ILoggerFactory loggerFactory) { if (next == null) throw new ArgumentNullException("next"); @@ -93,4 +97,3 @@ private StaticFileMiddleware CreateFileMiddleware(IBabel babel) } } } - \ No newline at end of file diff --git a/src/React.AspNet.Middleware/MemoryFileCacheCore.cs b/src/React.AspNet.Middleware/MemoryFileCacheCore.cs index 97b39f2a4..87fc47c90 100644 --- a/src/React.AspNet.Middleware/MemoryFileCacheCore.cs +++ b/src/React.AspNet.Middleware/MemoryFileCacheCore.cs @@ -11,6 +11,10 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.FileProviders; +#if NETCOREAPP2_0 || NETSTANDARD2_0 +using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; +#endif + namespace React.AspNet { /// @@ -19,14 +23,14 @@ namespace React.AspNet public class MemoryFileCacheCore : ICache { private readonly IMemoryCache _cache; - private readonly IHostingEnvironment _hostingEnv; + private readonly IWebHostEnvironment _hostingEnv; /// /// Initializes a new instance of the class. /// /// The cache to use /// The ASP.NET hosting environment. - public MemoryFileCacheCore(IMemoryCache cache, IHostingEnvironment hostingEnv) + public MemoryFileCacheCore(IMemoryCache cache, IWebHostEnvironment hostingEnv) { _cache = cache; _hostingEnv = hostingEnv; @@ -52,7 +56,7 @@ public MemoryFileCacheCore(IMemoryCache cache, IHostingEnvironment hostingEnv) /// The cache key /// Data to cache /// - /// Sliding expiration, if cache key is not accessed in this time period it will + /// Sliding expiration, if cache key is not accessed in this time period it will /// automatically be removed from the cache /// /// diff --git a/src/React.AspNet.Middleware/React.AspNet.Middleware.csproj b/src/React.AspNet.Middleware/React.AspNet.Middleware.csproj index 3a0c6904d..ab7bc01e2 100644 --- a/src/React.AspNet.Middleware/React.AspNet.Middleware.csproj +++ b/src/React.AspNet.Middleware/React.AspNet.Middleware.csproj @@ -5,7 +5,7 @@ Copyright 2014-Present Facebook, Inc ReactJS.NET - Babel middleware for ASP.NET Core Daniel Lo Nigro - netstandard2.0 + netstandard2.0;netcoreapp3.0 true React.AspNet.Middleware ../key.snk @@ -33,7 +33,7 @@ - + @@ -42,6 +42,10 @@ + + + + true diff --git a/src/React.AspNet.Middleware/ReactBuilderExtensions.cs b/src/React.AspNet.Middleware/ReactBuilderExtensions.cs index b02079217..4226c7a44 100644 --- a/src/React.AspNet.Middleware/ReactBuilderExtensions.cs +++ b/src/React.AspNet.Middleware/ReactBuilderExtensions.cs @@ -18,6 +18,10 @@ using Microsoft.Extensions.Caching.Memory; #endif +#if NETCOREAPP2_0 || NETSTANDARD2_0 +using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; +#endif + namespace React.AspNet { /// @@ -83,7 +87,7 @@ TinyIoCContainer.RegisterOptions registerOptions /// ASP.NET dependency injection container private static void RegisterAspNetServices(TinyIoCContainer container, IServiceProvider services) { - container.Register(services.GetRequiredService()); + container.Register(services.GetRequiredService()); #if !NET451 container.Register(services.GetRequiredService()); #endif diff --git a/src/React.AspNet/React.AspNet.csproj b/src/React.AspNet/React.AspNet.csproj index 731801770..1a4edb520 100644 --- a/src/React.AspNet/React.AspNet.csproj +++ b/src/React.AspNet/React.AspNet.csproj @@ -5,7 +5,7 @@ Copyright 2014-Present Facebook, Inc ReactJS.NET (ASP.NET Core MVC) Daniel Lo Nigro - netstandard2.0 + netstandard2.0;netcoreapp3.0 true React.AspNet ../key.snk @@ -30,10 +30,14 @@ - + + + + + true diff --git a/src/React.Router/React.Router.csproj b/src/React.Router/React.Router.csproj index 802002f74..007112960 100644 --- a/src/React.Router/React.Router.csproj +++ b/src/React.Router/React.Router.csproj @@ -5,7 +5,7 @@ Copyright 2014-Present Facebook, Inc ReactJS.NET Router Daniel Lo Nigro, Gunnar Már Óttarsson - netstandard2.0 + netstandard2.0;netcoreapp3.0 true React.Router ../key.snk @@ -27,12 +27,16 @@ - + + + + + diff --git a/src/React.Sample.Webpack.CoreMvc/React.Sample.Webpack.CoreMvc.csproj b/src/React.Sample.Webpack.CoreMvc/React.Sample.Webpack.CoreMvc.csproj index 365b09c9a..25430fde0 100644 --- a/src/React.Sample.Webpack.CoreMvc/React.Sample.Webpack.CoreMvc.csproj +++ b/src/React.Sample.Webpack.CoreMvc/React.Sample.Webpack.CoreMvc.csproj @@ -1,10 +1,19 @@  - netcoreapp2.1 + netcoreapp2.2;netcoreapp3.0 + + + + + + + + + @@ -12,11 +21,6 @@ - - - - - diff --git a/src/React.Sample.Webpack.CoreMvc/Startup.cs b/src/React.Sample.Webpack.CoreMvc/Startup.cs index f401e597e..382c37de6 100644 --- a/src/React.Sample.Webpack.CoreMvc/Startup.cs +++ b/src/React.Sample.Webpack.CoreMvc/Startup.cs @@ -35,13 +35,8 @@ public void ConfigureServices(IServiceCollection services) } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app) { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - // Initialise ReactJS.NET. Must be before static files. app.UseReact(config => { @@ -57,11 +52,23 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseStaticFiles(); +#if NETCOREAPP3_0 + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllerRoute("default", "{path?}", new { controller = "Home", action = "Index" }); + endpoints.MapControllerRoute("comments-root", "comments", new { controller = "Home", action = "Index" }); + endpoints.MapControllerRoute("comments", "comments/page-{page}", new { controller = "Home", action = "Comments" }); + }); +#else app.UseMvc(routes => { routes.MapRoute("default", "{path?}", new { controller = "Home", action = "Index" }); + routes.MapRoute("comments-root", "comments", new { controller = "Home", action = "Index" }); routes.MapRoute("comments", "comments/page-{page}", new { controller = "Home", action = "Comments" }); }); +#endif } } } diff --git a/tools/NuGet/nuget.exe b/tools/NuGet/nuget.exe index ccb2979c5..fb4eb39f0 100644 Binary files a/tools/NuGet/nuget.exe and b/tools/NuGet/nuget.exe differ diff --git a/tutorial-code/Startup.cs b/tutorial-code/Startup.cs index 0a8f041aa..baafa8e89 100644 --- a/tutorial-code/Startup.cs +++ b/tutorial-code/Startup.cs @@ -18,7 +18,7 @@ namespace ReactDemo { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IWebHostEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) @@ -43,20 +43,9 @@ public void ConfigureServices(IServiceCollection services) } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - app.UseBrowserLink(); - } - else - { - app.UseExceptionHandler("/Home/Error"); - } + app.UseDeveloperExceptionPage(); // Initialise ReactJS.NET. Must be before static files. app.UseReact(config => @@ -85,11 +74,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF app.UseStaticFiles(); - app.UseMvc(routes => + app.UseRouting(); + + app.UseEndpoints(endpoints => { - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); }); } } diff --git a/tutorial-code/tutorial-code.csproj b/tutorial-code/tutorial-code.csproj index f745a992e..8d87e3f5f 100644 --- a/tutorial-code/tutorial-code.csproj +++ b/tutorial-code/tutorial-code.csproj @@ -1,29 +1,30 @@  - - netcoreapp2.1 - true - tutorial-code - Exe - tutorial-code - - - - - PreserveNewest - - - - + + netcoreapp3.0 + true + tutorial-code + Exe + tutorial-code + + + + + PreserveNewest + + + + - - - - - - - - + + + + + + + Always + + diff --git a/tutorial-code/web.config b/tutorial-code/web.config index dc0514fca..a2cf1fe26 100644 --- a/tutorial-code/web.config +++ b/tutorial-code/web.config @@ -1,14 +1,17 @@  - - - + - + + + + + + - + \ No newline at end of file