I created a set of content types from a feature and after the installation, activation of this feature, I used (in list or document libraries) all content types contained in this feature but one, called CT1 for instance
After a while, I wanted to remove the never used content type, so I modified the feature, removed the content type CT1 from it, reinstalled the feature.
The content type CT1 was still in the content types list! Ok, no problem, from the UI I click on delete this content type, and…
The content type "CT1" is part of an application feature.
What a message! I removed it from the feature, but still, I have this error. I googled a lot and with the help of Vincent Rothwell I finally found a solution, not Microsoft allowed, but efficient!
First, I checked if the content type was not used somewhere in a site (see Vincent Rothwell article)
Then I went to the DB and in the ContentTypes table, you can filter the CT you want with:
Because I defined the CT, I knew the ContentTypeId. And I used sys.fn_varbintohexstr() because the ContentTypeId is of type tContentTypeId which is a varbinary(512)
Then I could delete the content type CT1 directly from the UI!