abpframework/abp · error · Exception

Mobile app folder name is not set!

Error message

Mobile app folder name is not set!

What it means

Thrown by `MobileAppExtensions.GetFolderName` when the `MobileApp` enum value does not match any of the handled cases (`ReactNative`, `Maui`). It is a raw `Exception` representing an unhandled/default enum branch.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/MobileApp.cs:24

{
    None,
    ReactNative,
    Maui
}

public static class MobileAppExtensions
{
    public static string GetFolderName(this MobileApp mobileApp)
    {
        switch (mobileApp)
        {
            case MobileApp.ReactNative:
                return "react-native";
            case MobileApp.Maui:
                return "MAUI";
        }

        throw new Exception("Mobile app folder name is not set!");
    }
}

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Ensure the `MobileApp` value passed is one of the supported members: `ReactNative` or `Maui`.
  2. If you added a new enum member, extend the `switch` in `GetFolderName` with its folder name.
  3. Validate the enum is defined (`Enum.IsDefined`) before calling `GetFolderName`.

Example fix

// before
var folder = mobileApp.GetFolderName(); // mobileApp = MobileApp.None
// after
var folder = (mobileApp == MobileApp.ReactNative ? "react-native"
            : mobileApp == MobileApp.Maui ? "MAUI"
            : throw new ArgumentOutOfRangeException(nameof(mobileApp)));
Defensive patterns

Strategy: validation

Validate before calling

if (!Enum.IsDefined(typeof(MobileApp), mobileApp) || mobileApp == 0)
    throw new ArgumentOutOfRangeException(nameof(mobileApp), "MobileApp must be ReactNative or Maui.");
var folder = mobileApp.GetFolderName();

Type guard

static bool IsSupportedMobileApp(MobileApp m) => m == MobileApp.ReactNative || m == MobileApp.Maui;

Try / catch

try { folder = mobileApp.GetFolderName(); }
catch (Exception ex) when (ex.Message.Contains("Mobile app folder name is not set"))
{
    logger.LogError("Unsupported MobileApp value {Value}.", mobileApp);
    throw;
}

Prevention

When it happens

Trigger: Passing a `MobileApp` value that is `None`/`0`/undefined, or a newly added enum member that `GetFolderName` has not been updated to handle.

Common situations: Defaulting `MobileApp` to `None`/0 in project-building code; an ABP version adds a new `MobileApp` member and this switch is not updated; casting an invalid int to the enum.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/c4c16048499c6c09. Report an issue: GitHub.