{"title":"AppSourceCop Hidden AS0072","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0072/","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-as0072, 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-as0072","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":"The attribute tag must be set to the next release version (Major.Minor).","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Hidden AS0072","slug":"appsourcecop-hidden-as0072","at":0,"chars":7348},{"level":2,"title":"Description","slug":"description","at":88,"chars":149},{"level":2,"title":"Remarks","slug":"remarks","at":237,"chars":767},{"level":2,"title":"Setting up AppSourceCop to validate the Obsolete tag","slug":"setting-up-appsourcecop-to-validate-the-obsolete-tag","at":1004,"chars":1105},{"level":3,"title":"Enabling the rule using a ruleset","slug":"enabling-the-rule-using-a-ruleset","at":1060,"chars":784},{"level":3,"title":"Setting up the AppSourceCop.json","slug":"setting-up-the-appsourcecopjson","at":1844,"chars":265},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":2109,"chars":252},{"level":2,"title":"Example of code triggering this rule","slug":"example-of-code-triggering-this-rule","at":2361,"chars":2065},{"level":3,"title":"Newly obsoleted object specifying a version different than the obsolete tag version","slug":"newly-obsoleted-object-specifying-a-version-different-than-the-obsolete-tag-version","at":2647,"chars":863},{"level":3,"title":"Preserving the obsolete tag for an object that changes obsolete state","slug":"preserving-the-obsolete-tag-for-an-object-that-changes-obsolete-state","at":3510,"chars":916},{"level":2,"title":"Example of code not triggering this rule","slug":"example-of-code-not-triggering-this-rule","at":4426,"chars":2775},{"level":3,"title":"Specifying a version equal to the target obsolete tag version","slug":"specifying-a-version-equal-to-the-target-obsolete-tag-version","at":4716,"chars":654},{"level":3,"title":"Updating the obsolete tag for an obsolete object that does changes obsolete state","slug":"updating-the-obsolete-tag-for-an-obsolete-object-that-does-changes-obsolete-state","at":5370,"chars":918},{"level":3,"title":"Preserving the obsolete tag for an object that does not change obsolete state","slug":"preserving-the-obsolete-tag-for-an-object-that-does-not-change-obsolete-state","at":6288,"chars":913},{"level":2,"title":"Related information","slug":"related-information","at":7201,"chars":147}],"text":"# AppSourceCop Hidden AS0072\nThe attribute tag must be set to the next release version.\n## Description\nThe attribute tag must be set to the next release version (Major.Minor). This rule is only relevant if the Major.Minor format is set.\n## Remarks\nThis rule verifies that the version specified as tag for ../attributes/devenv-obsolete-attribute or ../attributes/devenv-requiredpending-attribute attributes, or for objects whose obsolete state (not obsolete, obsolete pending, or obsolete removed) is updated, matches the version specified in the obsoleteTagVersion property of the AppSourceCop.json.\nObjects or methods which have the same state as in the baseline are not validated by this rule, but are validated by appsourcecop-as0074.\n> NOTE\n> This rule is only enabled when using the default obsoleteTagPattern in the AppSourceCop.json.\nThe version specified as obsoleteTagVersion can be the same as the current Major.Minor version specified in the version of your app.json, but it does not have to.\n## Setting up AppSourceCop to validate the Obsolete tag\n### Enabling the rule using a ruleset\nThe diagnostics for rule AS0072 are hidden by default, so you have to use a ../devenv-rule-set-syntax-for-code-analysis-tools to surface them.\nFor example, the following ruleset turns the diagnostic for rule AS0072 into an error.\n```json\n{\n    \"name\": \"My custom ruleset\",\n    \"rules\": [\n        {\n            \"id\": \"AS0072\",\n            \"action\": \"Error\",\n            \"justification\": \"Validating that obsolete tags have the right version is important\"\n        }\n    ]\n}\n```\n```json\n{\n    \"al.ruleSetPath\": \"custom.ruleset.json\"\n}\n```\n> NOTE\n> To fully validate obsolete properties and attributes, it is recommended to enable the rules appsourcecop-as0072, appsourcecop-as0073, appsourcecop-as0074, appsourcecop-as0075, and appsourcecop-as0076.\n### Setting up the AppSourceCop.json\nTo enable the validation, you must specify the obsoleteTagVersion in the AppSourceCop.json, without specifying the obsoleteTagPattern property so that the default pattern is used.\n```json\n{\n    \"obsoleteTagVersion\": \"2.0\"\n}\n```\n## How to fix this diagnostic?\nTo fix this diagnostic, make sure that all objects which are changing obsolete state in comparison to the baseline have an obsolete tag whose value is the one specified in the obsoleteTagVersion of the AppSourceCop.json.\n## Example of code triggering this rule\nIn the following example, the AppSourceCop is run against a baseline which has version 1.0 and expects the obsolete tag version for objects changing obsolete states to be 2.0.\n```json\n{\n    \"version\": \"1.0\",\n    \"obsoleteTagVersion\": \"2.0\"\n}\n```\n### Newly obsoleted object specifying a version different than the obsolete tag version\nVersion of the extension used as baseline:\n```al\ntable 50100 MyTable\n{\n    fields\n    {\n        field(50100; MyField; Integer) { }\n    }\n\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nCurrent version of the extension:\n```al\ntable 50100 MyTable\n{\n    ObsoleteState = Pending;\n    ObsoleteReason = 'Use table X instead.';\n    ObsoleteTag = '2.1';\n\n    fields\n    {\n        field(50100; MyField; Integer) { }\n    }\n\n    [Obsolete('Use function Y instead', '3.0')]\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nIn the current version of the extension, the table and the procedure are marked as obsolete pending. However, the obsolete tag values specified in the AL code are higher than the one specified in the AppSourceCop.json. The rule AS0072 will be triggered.\n### Preserving the obsolete tag for an object that changes obsolete state\nVersion of the extension used as baseline:\n```al\ntable 50100 MyTable\n{\n    ObsoleteState = Pending;\n    ObsoleteReason = 'Use table X instead.';\n    ObsoleteTag = '1.0';\n\n    fields\n    {\n        field(50100; MyField; Integer) { }\n    }\n}\n```\nCurrent version of the extension:\n```al\ntable 50100 MyTable\n{\n    ObsoleteState = Removed;\n    ObsoleteReason = 'Use table X instead.';\n    ObsoleteTag = '1.0';\n\n    fields\n    {\n        field(50100; MyField; Integer) { }\n    }\n}\n```\nIn the current version of the extension, the table's obsolete state is changed from obsolete pending to obsolete removed, which means that only upgrade code is now able to reference it. However, the obsolete tag value specified in the AL code has not been updated and is now lower than the one specified in the AppSourceCop.json. The rule AS0072 will be triggered.\n## Example of code not triggering this rule\nIn the following example, the AppSourceCop is run against a baseline which has version 1.0 and expects the obsolete tag version for objects changing obsolete states to be 2.0.\n```json\n{\n    \"version\": \"1.0\",\n    \"obsoleteTagVersion\": \"2.0\"\n}\n```\n### Specifying a version equal to the target obsolete tag version\nVersion of the extension used as baseline:\n```al\ncodeunit 50100 MyCodeunit\n{\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nCurrent version of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    ObsoleteState = Pending;\n    ObsoleteReason = 'Use codeunit X instead.';\n    ObsoleteTag = '2.0';\n\n    [Obsolete('Use function Y instead', '2.0')]\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nThe codeunit MyCodeunit is marked as obsolete with the current version of the extension. As the specified obsolete tags are matching the obsoleteTagVersion, no diagnostics are reported.\n### Updating the obsolete tag for an obsolete object that does changes obsolete state\nVersion of the extension used as baseline:\n```al\ntable 50100 MyTable\n{\n    ObsoleteState = Pending;\n    ObsoleteReason = 'Use table X instead.';\n    ObsoleteTag = '1.0';\n\n    fields\n    {\n        field(50100; MyField; Integer) { }\n    }\n}\n```\nCurrent version of the extension:\n```al\ntable 50100 MyTable\n{\n    ObsoleteState = Removed;\n    ObsoleteReason = 'Use table X instead.';\n    ObsoleteTag = '2.0';\n\n    fields\n    {\n        field(50100; MyField; Integer) { }\n    }\n}\n```\nIn the current version of the extension, the table's obsolete state is changed from obsolete pending to obsolete removed, which means that only upgrade code is now able to reference it. The obsolete tag value specified in the AL code has also been updated to the current obsoleteTagVersion in the AppSourceCop.json. The rule AS0072 will not be triggered.\n### Preserving the obsolete tag for an object that does not change obsolete state\nVersion 1.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    ObsoleteState = Pending;\n    ObsoleteReason = 'Use codeunit X instead.';\n    ObsoleteTag = '1.0';\n\n    [Obsolete('Use function Y instead', '1.0')]\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nVersion 2.0 of the extension:\n```al\ncodeunit 50100 MyCodeunit\n{\n    ObsoleteState = Pending;\n    ObsoleteReason = 'Use codeunit X instead.';\n    ObsoleteTag = '1.0';\n\n    [Obsolete('Use function Y instead', '1.0')]\n    procedure MyProcedure()\n    begin\n    end;\n}\n```\nThe codeunit MyCodeunit is marked as obsolete pending in the baseline and remains obsolete in the current version. The obsolete tag is then not validated by rule AS0072, but is validated by AS0074. Note that this example does not trigger any diagnostics from the AppSourceCop for obsolete tags.\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}