I’m working on migrating a project from ASP.NET Core 5.0 to .NET Core 8.0. In my project,
using Test_Site_1.Application.Interfaces.Contexts;
using Test_Site_1.Common.Dto;
using Test_Site_1.Domain.Entities.Products;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test_Site_1.Application.Services.Products.Commands.AddNewProduct
{
public interface IAddNewProductService
{
ResultDto Execute(RequestAddNewProductDto request);
}
public class AddNewProductService : IAddNewProductService
{
private readonly IDataBaseContext _context;
private readonly IWebHostEnvironment _environment;
public AddNewProductService(IDataBaseContext context, IWebHostEnvironment environment)
{
_context = context;
_environment = environment;
I’m using IHostingEnvironment to access the web root path for file uploads. However, in .NET Core 8.0, **IHostingEnvironment **has been replaced with IWebHostEnvironment. I’ve updated my code and namespaces accordingly, but I’m encountering issues with IWebHostEnvironment not being recognized.
1