{"title":"AppSourceCop Error AS0011","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0011/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/appsourcecop-as0011, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/appsourcecop-as0011","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"An affix is required.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Error AS0011","slug":"appsourcecop-error-as0011","at":0,"chars":4336},{"level":2,"title":"Description","slug":"description","at":49,"chars":1622},{"level":3,"title":"Using the property mandatoryAffixes","slug":"using-the-property-mandatoryaffixes","at":395,"chars":539},{"level":3,"title":"Using the properties mandatoryPrefix and mandatorySuffix","slug":"using-the-properties-mandatoryprefix-and-mandatorysuffix","at":934,"chars":737},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":1671,"chars":2518},{"level":3,"title":"For new objects","slug":"for-new-objects","at":2015,"chars":244},{"level":3,"title":"For existing objects","slug":"for-existing-objects","at":2259,"chars":1930},{"level":4,"title":"Example - Adding an affix to an existing codeunit","slug":"example---adding-an-affix-to-an-existing-codeunit","at":3044,"chars":1145},{"level":2,"title":"Related information","slug":"related-information","at":4189,"chars":147}],"text":"# AppSourceCop Error AS0011\nAn affix is required\n## Description\nAn affix is required.\nTo avoid name clashes for objects added by your extension and objects added by other extensions, an affix must be prepended or appended to the name of all new application objects, extension objects, and fields. See Benefits and Guidelines for using a Prefix or Suffix<../../compliance/apptest-prefix-suffix>.\n### Using the property mandatoryAffixes\nThe rule validates that at least one of the affixes specified in the mandatoryAffixes property of the AppSourceCop.json file is used either at prefix or at suffix on identifier names of new elements.\nSetting|Mandatory|Value\nmandatoryAffixes|No|Affixes that must be prepended or appended to the name of all new application objects, extension objects, and fields.\nThe mandatoryAffixes property expects to receive an array of string as follows:\n```json\n{\n    \"mandatoryAffixes\": [ \"Foo\", \"Bar\" ]\n}\n```\n### Using the properties mandatoryPrefix and mandatorySuffix\nTo preserve backward compatibility, the properties mandatoryPrefix and mandatorySuffix are still supported by the AppSourceCop.\nBoth properties expect to receive a string as follows:\n```json\n{\n    \"mandatoryPrefix\": \"Prefix\",\n    \"mandatorySuffix\": \"Suffix\"\n}\n```\nHowever, their meaning has been modified to be closer to the new mandatoryAffixes property. The mandatory prefix and mandatory suffix properties are now both defining an affix that can be used either as prefix or as suffix.\nAs a consequence, we encourage you to use the new property mandatoryAffixes that offers more flexibility by allowing you to define more than two affixes, but also a more meaningful name .\n## How to fix this diagnostic?\n> NOTE\n> If you are targeting the AppSource marketplace and do not have affixes registered, follow the steps defined in Get Started with Building Apps<../readiness/get-started>.\nIf you are not targeting the AppSource marketplace, you can suppress this rule using ../devenv-using-code-analysis-tool-with-rule-set.\n### For new objects\nFor objects that are introduced with the current version of the extension, appending one of the mandatory affixes to the object's name will fix the diagnostic.\nRenaming objects which are not part of the baseline is allowed.\n### For existing objects\nFor objects which already exist in the version of the extension used as baseline, it is not possible to rename them. It is therefore not possible to append one of the mandatory affixes. Instead, the offending object should be deprecated using the ../properties/devenv-obsoletestate-property property and a new object whose name has one of the mandatory affixes should be introduced.\n> NOTE\n> The lack of affixes for enum values defined in enum extensions is reported as a warning with appsourcecop-as0098 if the enum value is already defined in your baseline extension. If the enum value is not defined in your baseline extension, it is reported as an error with appsourcecop-as0011. Make sure to specify your baseline extension in the AppSourceCop.json file.\n#### Example - Adding an affix to an existing codeunit\nFor instance, if the baseline of the extension contains a codeunit without affix:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure()\n    begin\n        // Business logic.\n    end;\n}\n```\nThe extension should be modified into:\n```al\ncodeunit 50100 MyCodeunit\n{\n    ObsoleteState = Pending;\n    ObsoleteReason = 'Use Foo_MyCodeunit instead.';\n\n    procedure MyProcedure()\n    var\n        c: Codeunit Foo_MyCodeunit;\n    begin\n        // Re-direct calls to not break the runtime behaviour of dependent extensions.\n        c.MyProcedure();\n    end;\n}\n\ncodeunit 50120 Foo_MyCodeunit\n{\n    procedure MyProcedure()\n    begin\n        // Business logic.\n    end;\n}\n```\nOnce all dependent extensions have been updated to use the codeunit Foo_MyCodeunit instead of MyCodeunit, the codeunit MyCodeunit can be removed.\n> NOTE\n> When new objects are added to this rule, the transition can be made gradually because new objects are caught by the AS0011 rule, whereas the AS0098 rule catches existing or modified objects. The warning with the same behavior is described here: appsourcecop-as0098.\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}