Wednesday, January 28, 2009

Workflow activity development and file locking

As some of you might have noticed, the dll:s containing the custom workflow activities might get locked and hence the compilation fails in it's final stage.

To handle this, I tried a good program called Unlocker 1.8.7 which you can find here: http://ccollomb.free.fr/unlocker/ - it is freeware and it will tell you which processes are locking a file and can help you kill them.

So, what is locking my dll? Well, actually several processes are involved both the MSCRMAsyncService and the IIS worker process (w3wp).

The most obvious way of handling it is just restarting the two services and that will work. However, restarting the w3wp process will require the entire CRM application to be recompiled which will create extra long and annoying waits. Instead, just recycle the applicationpool involved (CRMAppPool).

There are no problems restarting the MSCRMAsyncService.

And if you want to do it all in the pre-build event just add the following lines:

net stop "MSCRMAsyncService"
net start "MSCRMAsyncService"
cscript C:\Inetpub\AdminScripts\adsutil.vbs stop_server W3svc/AppPools/CRMAppPool cscript C:\Inetpub\AdminScripts\adsutil.vbs start_server W3svc/AppPools/CRMAppPool

And if you are still having problems, use the unlocker program!

Gustaf Westerlund
Microsoft Dynamics CRM Architect

Logica
www.logica.com

No comments:

Post a Comment