I follow this tutorial about ASP.NET Core in Pluralsight.
It uses a package named OdeToCode.UseNodeModules but when I used it in "Startup.cs", I got this:
Argument 2: cannot convert from 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment' OdeToFood
Screenshot of the code and error in my project
You can see the usage of the package in the code below. The error refers to that "environment" parameter of UseNodeModules.
public class Startup
{
// ...
public void Configure(IApplicationBuilder app, IHostingEnvironment environment)
{
// ...
app.UseNodeModules(environment);
// ...
}
}
You see, That "IHostingEnvironment" above is an obsolete type now. It is "IWebHostEnvironment" in my project. But even when I use the obsolete types, I still get that error.
So, I want to know the solution. How can I use this package in 3? If there is no way, Please kindly show me an alternate way. I am a greenhorn.
From the source code ,it seems no need to pass the environment in asp.net core 3.x.
Reference:
https://odetocode.com/blogs/scott/archive/2019/10/07/usenodemodules-updated-for-net-core-3.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.