web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Deployment error when ...
Power Apps
Suggested Answer

Deployment error when removing Model-Driven App

(0) ShareShare
ReportReport
Posted on by 45
Hey there, 
some months ago, I have created a model driven app with very simple functionality. Now this app has been removed by another and I am trying to remove this old app from an managed solution. 
But when I remove the app from the solution in my developer environment and deploy the solution to test environment, I got this error:
 
ImportAsHolding failed with exception :Import failed: The DELETE statement conflicted with the REFERENCE constraint "appmodule_appaction_appmoduleid". The conflict occurred in database "db_crmcoreemea_20220824_09164032_75de", table "dbo.appactionBase", column 'AppModuleId'. The statement has been terminated.
 
This would mean that there are some records in table appaction, associated with the app I want to delete 
But this is not the case. None of records in the table appmodule is related with the app I want to remove (checked in XrmToolBox for Dataverse).
 
Any idea how to resolve the error and remove the app?
Categories:
I have the same question (0)
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    @ryjan Hi,
    When you use XrmToolBox, what is your query ? (FetchXML builder)
    Have you checked the import log or similar detailed log? It might contain the AppModuleId value.
    Rebuild/widen the query/filter .
     
    Another thread for you reference 
     
  • Suggested answer
    Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    Hi there,

    When you deploy in a managed environment, I suggest you to get habit to always export managed solution AND unmanaged solution. You save your unmanaged solutions in a cloud or drive somewhere. This way, you will be able to get components back to unmanaged environment if issues like that happened :).

    If it happens recently, I think you can consider to roll back dev environment to get component back.

    Some will suggest to edit components in the XML, but I don't think it is a proper way to do it since you can completly destroy your system by doing weird things like that. But...

    Now, if you still have your managed solution... It is not a bulletproof method and I do not suggest to use it in any other ways than last resort for an issue like this. You can get your managed solution used to deploy, open solution.xml and simply change <Managed> value to 0:
     
    And then, reimport that solution in your Dev environment, remove tables from model-driven app and redeploy as managed solution in Managed environment to crush tables dependencies. I think this is a clean and safe way to do it AS LAST RESORT. lol

    I hope it helps!
    __________________________________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
  • ryjan Profile Picture
    45 on at
    Hi there,
    thanks for help. Let me provide some more details. 
    I am using Power Pipelines so there is always an backup of the solution file. 
    The app I want to delete has GUID 
    79964cb8-34fe-ee11-a1fe-000d3aaed952 in the DEV Environment I am exporting from
    6438f319-dec9-ef11-b8e9-6045bd8bac36 in the TEST Environment I am exporting to
    But there are no recors in the table appacion related to the respective app GUID
     
    SELECT *
    FROM dbo.appaction
    WHERE appmoduleid = '6438f319-dec9-ef11-b8e9-6045bd8bac36'
     
    Thanks @Gabriel G. for pointing me to the solution XML file
    Indeed there are many MissingDependency items. 
    Any idea how to resolve them in other way than delete and re-import the solution?
     
  • ryjan Profile Picture
    45 on at
    Hi there,
    thanks for help. Let me provide some more details. 
    I am using Power Pipelines so there is always an backup of the solution file. 
    The app I want to delete has GUID 
    79964cb8-34fe-ee11-a1fe-000d3aaed952 in the DEV Environment I am exporting from
    6438f319-dec9-ef11-b8e9-6045bd8bac36 in the TEST Environment I am exporting to
    But there are no recors in the table appacion related to the respective app GUID
     
    SELECT *
    FROM dbo.appaction
    WHERE appmoduleid = '6438f319-dec9-ef11-b8e9-6045bd8bac36'
     
    Thanks @Gabriel G. for pointing me to the solution XML file
    Indeed there are many MissingDependency items. 
    Any idea how to resolve them in other way than delete and re-import the solution?
     
  • Suggested answer
    Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    Hi again,
     
    Best scenario is to rollback your environment if possible (I know, this is probably a huge no no cause you will delete many development). Otherwise, you can try to manipulate XML to remove manually all dependencies, but there is liek 85% chance it will results as fail on import or potentially break a component... Since GUIDs are not the same, whatever you do on your dev's app, changes will not affect your other environment...

    Another alternative is to manage to get your solution with a further version (with model-driven app removed) and import it to PROD as 'Upgrade' instead of 'Update'.

     
    If nothing works, I have no other idea...

    I hope it helps!
    ___________________________________________________________

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
  • ryjan Profile Picture
    45 on at
    Hi @Gabriel G. thanks for your advice, I tried but unfortunately it did not remove the App in the target environment. 
  • Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    Hi again!
     
    @ryjan, just to make sure, can you verify that you don't have unmanaged layers on your component in PROD environment ? (unmanaged layer causes the component to keep a false state and your changes will be ignore for that component)

    If you have unmanaged layer, remove it and retry your deployment procedure.
     
    To remove layer:
     
    Select it and click 'Remove layer' in the command bar.

    Cheers!
  • ryjan Profile Picture
    45 on at
    Hi @Gabriel G. yes I have checked and there is no additional solution layer 
  • Suggested answer
    pavanmanideep Profile Picture
    495 Power Up Champ - 2025 on at
    Hi,
     
    After removing the Model Driven App from the Unmanaged Solution in Dev, Click clone as Solution, and then export this solution as Managed Solution and try to import this manually to the Test Environment.
     
    Ideally this should remove any solution dependencies and while importing the solution to Test environment, Click on Upgrade and Overwrite Customizations option.
     
    Hope this helps..

    Cheers,
    PMDY
    Microsoft Business Applications MVP
    Subscribe to my blog: https://ecellorscrm.com

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard