Chad Boettcher
Chad Boettcher

Reputation: 7

Virtual File System and Areas

I'm trying to use Areas in my ASP.NET Core ABP project like so:

Folder Structure

I'm trying to add a single file bundle like this:

<abp-script src="/Areas/Community/Pages/Mentors/Index.js" />

When I try running the page I get the following error:

AbpException: Could not find the bundle file '/Areas/Community/Pages/Mentors/Index.js' from IWebContentFileProvider

The documentation says the files can be located in Pages, Views, Components, and Themes but it seems limiting if it doesn't also support areas. Do I need to add a route somewhere so the virtual file system can find it?

Update: I found the source code in \Volo.Abp.AspNetCore\Volo\Abp\AspNetCore\VirtualFileSystem\AbpAspNetCoreContentOptions.cs

where it sets the AllowedExtraWebContentFolders list:

AllowedExtraWebContentFolders = new List<string>
{
    "/Pages",
    "/Views",
    "/Themes",
    "/Components"
};

Is there any way to add to this list?

Upvotes: 0

Views: 576

Answers (1)

maliming
maliming

Reputation: 185

You can configure it in the module's ConfigureServices method.

public override void ConfigureServices(ServiceConfigurationContext context)
{
    Configure<AbpAspNetCoreContentOptions>(options =>
    {
        options.AllowedExtraWebContentFolders.Add("/Areas");
    });
}

Upvotes: 1

Related Questions