November 23, 2017

How to Delete a model in Dynamics 365 for FO


I was trying for this for very long time, on initial stage of development it was one of the biggest headache for me. HOW TO DELTE A MODEL. So now finally I come to conclusion on this.

Note: I would recommend check with all other developer who is sharing the same dev machine before deleting this to make nothing will go wrong. Take a backup of your code.

Prerequisite:
1.     Login to server using admin credentials
2.     Check your model directory it must be sore under below path/folder
C:\AOSService\PackagesLocalDirectory/<your model>





There can be two scenarios here,
1.     Model belongs to its own package
2.     Model belongs to standard (existing) package.

1.     If your model belongs to its own package (For example: An extension package with no other models in the package):
a.      Stop the following services: The AOS web service and the Batch Management Service
b.     Delete the package folder C:\AOSService\PackagesLocalDirectory\<your model>
c.      Restart the services from step 1
d.     If Visual Studio is running, refresh your models (Visual Studio > Dynamics 365 > Model management > Refresh models)
e.      In Visual Studio, perform a full database synchronization (Visual Studio > Dynamics 365 > Synchronize database...)





2.     If your model belongs to a package with multiple models (For example, <your model> overlays Application Suite):
a.      Stop the following services: The AOS web service and the Batch Management Service
b.     Delete the model folder C:\AOSService\PackagesLocalDirectory<PackageName>\<your model> (In this example PackageName=ApplicationSuite)
c.      Restart the services from step 1
d.     In Visual Studio, refresh your models (Visual Studio > Dynamics 365 > Model management > Refresh models)
e.      In Visual Studio, build the package that the deleted models belonged to (Visual Studio > Dynamics 365 > Build models...)
f.       In Visual Studio, perform a full database synchronization (Visual Studio > Dynamics 365 > Synchronize database...)


Enjoy..
Harry.

Disc: This post is referred from here.


2 comments:

  1. Hi can you also share the steps to remove it from Production env through lcs

    ReplyDelete
    Replies
    1. Try this link,
      https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/deployment/uninstall-deployable-package

      Delete

Thanks