Here are some details of my app and the error I am getting:
.NetCore Version : 2.0
Exception File name : Startup.cs
line number : 41 UseWebpackDevMiddleware()
Package Reference:
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
<PackageReference Include="Microsoft.PowerBI.Api" Version="2.0.12" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
Stack trace:
System.TypeLoadException
HResult=0x80131522
Message=Could not load type 'System.Runtime.Serialization.SerializationBinder'
from assembly 'netstandard, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'.
Source=Newtonsoft.Json
StackTrace:
at Newtonsoft.Json.JsonSerializer..ctor()
at Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings settings)
at Microsoft.AspNetCore.Builder.WebpackDevMiddleware.UseWebpackDevMiddleware(IApplicationBuilder appBuilder, WebpackDevMiddlewareOptions options)
at WebUI.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in
F:\code\UI\WebUI\Startup.cs:line 41
And here are some details of my custom nuget project:
Application Framework : .net Framework 4.6.1
Package information :
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.ApplicationInsights" version="2.6.4" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault.WebKey" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Azure.ServiceBus.EventProcessorHost" version="2.2.10" targetFramework="net461" />
<package id="Microsoft.Azure.Services.AppAuthentication" version="1.1.0-preview" targetFramework="net461" />
<package id="Microsoft.Azure.WebJobs" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Azure.WebJobs.Core" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Azure.WebJobs.ServiceBus" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.1" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.19.8" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Logging" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Protocols" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Tokens" version="5.2.2" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.11" targetFramework="net461" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.12" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net461" />
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net461" />
<package id="StyleCop.MSBuild" version="4.7.49.1" targetFramework="net461" developmentDependency="true" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
<package id="System.Console" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.4.0" targetFramework="net461" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
<package id="System.Globalization" version="4.3.0" targetFramework="net461" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" />
<package id="System.IdentityModel.Tokens.Jwt" version="5.2.2" targetFramework="net461" />
<package id="System.IO" version="4.3.0" targetFramework="net461" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
<package id="System.Spatial" version="5.6.4" targetFramework="net461" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
<package id="WindowsAzure.ServiceBus" version="3.4.5" targetFramework="net461" />
<package id="WindowsAzure.Storage" version="7.2.1" targetFramework="net461" />
</packages>
The .netCore
web application throws exception at UseWebpackDevMiddleware
in startup.cs
after including the nuget detailed above.
What can I do to solve this?
You should not use UseWebpackDevMiddleware
for library reference
. For Nuget Reference
, you need to reference it by Nuget or adding them to .csproj
content. They will be resolved when building the project.
UseWebpackDevMiddleware
uses web pack
which is a static module bundler for modern JavaScript applications to package static files reference
like javascript
, css
and etc.
User contributions licensed under CC BY-SA 3.0