Install and Upgrade codeunits should have Access set to Internal (AC0007)

Install and Upgrade codeunits are intended for lifecycle execution only and are not designed to expose reusable APIs. Declaring them as Public unnecessarily broadens their surface area and increases coupling between extensions.

Making these codeunits internal ensures they are only accessible within the extension that defines them, preventing external dependencies on implementation details that are meant to run only during installation or upgrade.

A code fix is available for this diagnostic.

Example

The following Install codeunit is public:

codeunit 50100 MyCodeunit // Set Access property to Internal for Install and Upgrade codeunits. [AC0007]
{
    SubType = Install;

    trigger OnInstallAppPerCompany()
    begin
    end;
}

To fix this, set Access to Internal:

codeunit 50100 MyCodeunit
{
    Access = Internal;
    SubType = Install;

    trigger OnInstallAppPerCompany()
    begin
    end;
}