{"title":"AppSourceCop Error AS0042","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0042/","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-as0042, 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-as0042","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":"Table key property changes that cause destructive changes must not be removed.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Error AS0042","slug":"appsourcecop-error-as0042","at":0,"chars":936},{"level":2,"title":"Description","slug":"description","at":106,"chars":94},{"level":2,"title":"Remarks","slug":"remarks","at":200,"chars":308},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":508,"chars":281},{"level":2,"title":"Related information","slug":"related-information","at":789,"chars":147}],"text":"# AppSourceCop Error AS0042\nTable key property changes that cause destructive changes must not be removed\n## Description\nTable key property changes that cause destructive changes must not be removed.\n## Remarks\nThis error occurs when an attempt is made to remove table key properties that have already been published and are considered destructive. Destructive changes can lead to data loss, corruption, or other issues that can break the upgrade process for existing installations and dependent extensions.\n## How to fix this diagnostic?\nTo resolve this error, you need to avoid removing published table key properties that are considered destructive. Here are the steps:\n1. Locate the table key property in your code that is being removed.\n2. Restore the property to its original state.\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}