Removing a module from Standard acceptance Test Environments in Dynamics Finance and Operations

A lot of blogs out there as well as an msdn post about how to uninstall or remove a package from the standard acceptance test Teir 2 environments mentioning the process are available. I here will address what is not mentioned in all of those and I learnt after going through the process myself with Microsoft operations team.

Problem: When you upload a deployable package LCS gives out a generic error saying

“Unknown error occurred during package deployment. Please try again later. If the issue persists, contact support.”

PackageDeploymentError

Reason:

Creating packages with the module to remove name being placed in  ModuleToRemove.txt file being placed in the scripts folder of the deployable package is not enough if the package only contains the module you are trying to remove. In order for removal to work the package should contain all other packages while only the ModuleToRemove.txt file will contain the name of the module to remove. When you apply the package created in this order LCS actually prompts a window saying your package will remove the below mentioned modules from the environment and makes your confirm it one more time before beginning deployment.

In the Operation team’s own words:

“The error we’re seeing in LCS is that the package has no modules. That’s not supported and so I’d like to clarify with the customer what they are trying to do in this scenario. If they really want to remove all modules, can they just redeploy the environment instead? If they are trying to remove one specific module but have multiple installed, the package should still contain the others they’d like to keep. For example, if they have modules A, B, and C installed, and are trying to remove module C, the package should just contain modules A and B and then C would get wiped out.”

Surprisingly you cannot just remove all packages and MS recommends redeploying the environment in order to do so but you would loose you data wouldn’t you? Here’s there response to that

If you just want to remove one of those, you can create a new package with the other module and follow the same steps linked in the documentation to remove the unwanted one (adding an entry to the ModuleToRemove.txt)

If you want to remove them both but keep your data, you can export the database to the asset library before redeploying the environment. That way you can import the database after creating a new environment.”