Can't create development ad hoc app (Big Sur)

When trying to build a development app using Xcode 12.4 on Big Sur 11.2.3, the app doesn't build and I get the error message “AppName” is damaged and can’t be opened. Delete “AppName” and download it again from the App Store.