Search code examples
asp.net-core.net-coreodataaspnetboilerplatetypeloadexception

System.Web.HttpPostedFileBase not found with aspnetboilerplate


I'm developing asp .net core web application with boilerplate and trying to use ODATA. At starting application on line

//Initializes ABP framework.
app.UseAbp(options => { options.UseCastleLoggerFactory = false; });

i'm getting an exception:

An exception of type 'System.TypeLoadException' occurred in Abp.dll but was not handled in user code

Could not load type 'System.Web.HttpPostedFileBase' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

this exception raises when i add reference of AbpWebApiODataModule:

[DependsOn(
        typeof(MyApplicationModule),
        typeof(IdentityModule),
        typeof(MyEntityFrameworkCoreModule),
        typeof(AbpAspNetCoreModule),
        typeof(AbpAspNetCoreSignalRModule),
        typeof(AbpWebApiODataModule)        
            )
    ]
    public class MyWebModule : AbpModule
    {

How to can i fix it and add AbpOdata?

P.S.

dotnet --version == 2.1.401

packages:

    <PackageReference Include="Abp.AspNetCore.SignalR" Version="3.8.2" />
    <PackageReference Include="Abp.Web" Version="3.8.2" />
    <PackageReference Include="Abp.Web.Api" Version="3.8.2" />
    <PackageReference Include="Abp.Web.Api.OData" Version="3.8.2" />
    <PackageReference Include="Microsoft.AspNet.OData" Version="7.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.3" />
    <PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />    
    <PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="2.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.3" />
    <PackageReference Include="Castle.Core" Version="4.3.1" />
    <PackageReference Include="Abp.AspNetCore" Version="3.8.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.1.1" PrivateAssets="All" />   

Solution

  • For ASP.NET Core, it's Abp.AspNetCore.OData NuGet package.