Learn how to build ASP.NET apps that can run anywhere.
diff --git a/samples/WebApp/WebApp.csproj b/samples/WebApp/WebApp.csproj
index b82ebfc..319869d 100644
--- a/samples/WebApp/WebApp.csproj
+++ b/samples/WebApp/WebApp.csproj
@@ -1,17 +1,9 @@
- netcoreapp2.0
+ netcoreapp3.1
-
-
-
-
-
-
-
-
diff --git a/src/Webpack.AspNetCore/DevServer/Internal/DevServerManifestReader.cs b/src/Webpack.AspNetCore/DevServer/Internal/DevServerManifestReader.cs
index 999fc58..636d97c 100644
--- a/src/Webpack.AspNetCore/DevServer/Internal/DevServerManifestReader.cs
+++ b/src/Webpack.AspNetCore/DevServer/Internal/DevServerManifestReader.cs
@@ -1,8 +1,8 @@
-using Newtonsoft.Json;
-using System;
+using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
+using System.Text.Json;
using System.Threading.Tasks;
using Webpack.AspNetCore.Internal;
@@ -54,7 +54,7 @@ public async ValueTask> ReadAsync()
}
var manifestJson = await response.Content.ReadAsStringAsync();
- manifest = JsonConvert.DeserializeObject>(manifestJson);
+ manifest = JsonSerializer.Deserialize>(manifestJson);
CacheManifest(etag, manifest);
diff --git a/src/Webpack.AspNetCore/Static/Internal/PhysicalFileManifestReader.cs b/src/Webpack.AspNetCore/Static/Internal/PhysicalFileManifestReader.cs
index ebfbeaa..6f6aac9 100644
--- a/src/Webpack.AspNetCore/Static/Internal/PhysicalFileManifestReader.cs
+++ b/src/Webpack.AspNetCore/Static/Internal/PhysicalFileManifestReader.cs
@@ -1,7 +1,7 @@
-using Newtonsoft.Json;
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
+using System.Text.Json;
using System.Threading.Tasks;
using Webpack.AspNetCore.Internal;
@@ -43,7 +43,7 @@ public async ValueTask> ReadAsync()
{
var manifestJson = await manifestReader.ReadToEndAsync();
- return JsonConvert.DeserializeObject>(
+ return JsonSerializer.Deserialize>(
manifestJson
);
}
diff --git a/src/Webpack.AspNetCore/Static/Internal/StaticContext.cs b/src/Webpack.AspNetCore/Static/Internal/StaticContext.cs
index 632d1ee..d17556e 100644
--- a/src/Webpack.AspNetCore/Static/Internal/StaticContext.cs
+++ b/src/Webpack.AspNetCore/Static/Internal/StaticContext.cs
@@ -14,7 +14,7 @@ internal class StaticContext
private readonly IFileProvider fileProvider;
private readonly StaticOptions options;
- public StaticContext(IOptions optionsAccessor, IHostingEnvironment env)
+ public StaticContext(IOptions optionsAccessor, IWebHostEnvironment env)
{
if (optionsAccessor == null)
{
diff --git a/src/Webpack.AspNetCore/Webpack.AspNetCore.csproj b/src/Webpack.AspNetCore/Webpack.AspNetCore.csproj
index 0d8fe83..ab1eb8c 100644
--- a/src/Webpack.AspNetCore/Webpack.AspNetCore.csproj
+++ b/src/Webpack.AspNetCore/Webpack.AspNetCore.csproj
@@ -10,12 +10,10 @@
https://github.com/sergeysolovev/webpack-aspnetcore
Release notes are at https://github.com/sergeysolovev/webpack-aspnetcore/releases
https://github.com/sergeysolovev/webpack-aspnetcore/blob/master/LICENSE
- netstandard2.0
+ netcoreapp3.1
-
-
-
+
diff --git a/test/WebSites/BasicWebSite/BasicWebSite.csproj b/test/WebSites/BasicWebSite/BasicWebSite.csproj
index c5620b6..e9e869e 100644
--- a/test/WebSites/BasicWebSite/BasicWebSite.csproj
+++ b/test/WebSites/BasicWebSite/BasicWebSite.csproj
@@ -2,17 +2,13 @@
$(DefaultItemExcludes);node_modules\**
-
+
- netcoreapp2.0
+ netcoreapp3.1
-
-
-
-
-
+
diff --git a/test/WebSites/BasicWebSite/Startup.cs b/test/WebSites/BasicWebSite/Startup.cs
new file mode 100644
index 0000000..f809c67
--- /dev/null
+++ b/test/WebSites/BasicWebSite/Startup.cs
@@ -0,0 +1,31 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace BasicWebSite
+{
+ public class Startup
+ {
+ private static readonly string publicPath = "/public/";
+
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddMvc();
+
+ services.AddWebpack().AddDevServerOptions(opts =>
+ {
+ opts.PublicPath = publicPath;
+ opts.Port = 8081;
+ opts.ManifestFileName = "webpack-assets.json";
+ });
+ }
+
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ app.UsePathBase(publicPath);
+ app.UseWebpackDevServer();
+ app.UseRouting();
+ app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute());
+ }
+ }
+}
diff --git a/test/WebSites/BasicWebSite/StartupWithStaticFileOption.cs b/test/WebSites/BasicWebSite/StartupWithStaticFileOption.cs
new file mode 100644
index 0000000..86bfe3a
--- /dev/null
+++ b/test/WebSites/BasicWebSite/StartupWithStaticFileOption.cs
@@ -0,0 +1,33 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace BasicWebSite
+{
+ public class StartupWithStaticFileOption
+ {
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddMvc();
+ services.AddWebpack().AddStaticOptions(opts =>
+ {
+ opts.RequestPath = "/public/";
+ opts.ManifestDirectoryPath = "/dist/";
+ opts.OnPrepareResponse = respContext =>
+ respContext.Context.Response.Headers.Add(
+ key: "Cache-control",
+ value: "public,max-age=31536000"
+ );
+ opts.UseStaticFileMiddleware = true;
+ });
+ }
+
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ app.UseWebpackStatic();
+ app.UseRouting();
+ app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute());
+ }
+ }
+}
diff --git a/test/Webpack.AspNetCore.Tests.Integration/DevServer/DevServerTestContext.cs b/test/Webpack.AspNetCore.Tests.Integration/DevServer/DevServerTestContext.cs
index dcfce72..0eabd92 100644
--- a/test/Webpack.AspNetCore.Tests.Integration/DevServer/DevServerTestContext.cs
+++ b/test/Webpack.AspNetCore.Tests.Integration/DevServer/DevServerTestContext.cs
@@ -1,10 +1,10 @@
-using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Net.Http;
+using BasicWebSite;
namespace Webpack.AspNetCore.Tests.Integration.DevServer
{
@@ -19,28 +19,13 @@ public class DevServerTestContext : IDisposable
public DevServerTestContext()
{
var builder = new WebHostBuilder()
- .UseContentRoot(WebSite.GetContentRoot())
.ConfigureServices(services =>
- {
- services.AddMvc();
-
- services.AddWebpack().AddDevServerOptions(opts =>
- {
- opts.PublicPath = publicPath;
- opts.Port = 8081;
- opts.ManifestFileName = "webpack-assets.json";
- });
-
services.AddSingleton(
new CustomHttpContextAccessor(publicPath)
- );
- })
- .Configure(app =>
- {
- app.UsePathBase(publicPath);
- app.UseWebpackDevServer();
- app.UseMvcWithDefaultRoute();
- });
+ )
+ )
+ .UseStartup()
+ .UseContentRoot(WebSite.GetContentRoot());
server = new TestServer(builder);
client = server.CreateClient();
diff --git a/test/Webpack.AspNetCore.Tests.Integration/Static/StaticTestContext.cs b/test/Webpack.AspNetCore.Tests.Integration/Static/StaticTestContext.cs
index 8155eb3..be59abd 100644
--- a/test/Webpack.AspNetCore.Tests.Integration/Static/StaticTestContext.cs
+++ b/test/Webpack.AspNetCore.Tests.Integration/Static/StaticTestContext.cs
@@ -1,5 +1,4 @@
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
@@ -7,6 +6,7 @@
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
+using BasicWebSite;
using Webpack.AspNetCore.Static.Internal;
namespace Webpack.AspNetCore.Tests.Integration.Static
@@ -48,28 +48,11 @@ void startServer()
.UseContentRoot(WebSite.GetContentRoot())
.UseWebRoot(webRoot)
.ConfigureServices(services =>
- {
- services.AddMvc();
- services.AddWebpack().AddStaticOptions(opts =>
- {
- opts.RequestPath = "/public/";
- opts.ManifestDirectoryPath = "/dist/";
- opts.OnPrepareResponse = respContext =>
- respContext.Context.Response.Headers.Add(
- key: "Cache-control",
- value: "public,max-age=31536000"
- );
- opts.UseStaticFileMiddleware = true;
- });
-
services.AddSingleton(
new CustomHttpContextAccessor()
- );
- })
- .Configure(app => {
- app.UseWebpackStatic();
- app.UseMvcWithDefaultRoute();
- });
+ )
+ )
+ .UseStartup();
server = new TestServer(builder);
setupWaitingForStorageUpdate();
diff --git a/test/Webpack.AspNetCore.Tests.Integration/Webpack.AspNetCore.Tests.Integration.csproj b/test/Webpack.AspNetCore.Tests.Integration/Webpack.AspNetCore.Tests.Integration.csproj
index cfc082b..400d1ff 100644
--- a/test/Webpack.AspNetCore.Tests.Integration/Webpack.AspNetCore.Tests.Integration.csproj
+++ b/test/Webpack.AspNetCore.Tests.Integration/Webpack.AspNetCore.Tests.Integration.csproj
@@ -3,7 +3,7 @@
true
- netcoreapp2.0
+ netcoreapp3.1
@@ -18,11 +18,14 @@
-
-
-
-
-
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+