Just started a major part of a 4.0 to 2011 conversion and began to re-work my Plug-ins. I did this for multiple reasons, but the main one is that I wrote a lot of 4.0 plugins on the fly while I was learning how to write them. Needless to say, a lot of my code was not very efficient and needed some re factoring. Lots of code duplication across multiple projects.
The first thing I did was to install the CRM VS2010 developer extensions and use them to create my Plugin project from scratch, along with adding a CRMPackage project to deploy the plugin.
I really like being able to browse the entity in CRM Explorer, right-click and select to “Create Plug-In”, select the type, etc. It creates all the basics for you. Sweet.
The first time you have all your Plug-ins and steps/messages (Post Create, Post Update, etc.) defined, you can then go to the CrmPackage project and deploy the Plugin. It sets everything up for you, so you don’t have to go into the Plugin registration tool and manually add the plug-in, steps, images, etc.
However, I also saw that if you are just working in the code making minor changes, that this ‘deploy’ step can take some time, slowing down your development.
So I wanted to see if I could just update the Assembly DLL directly, since my steps and target images weren’t changing. I was just adding new functional code or fixing bugs.
This can be done, but it’s tricky. The first couple of times I tried it, the Plugin Registration Tool would lock up tight requiring me to kill it in Task Manager.
Part of the problem is that in order to copy the .PDB debug symbols to the serverbinassembly directory, you have to issue an IISRESET in the build process.
I do this as a post-build event command line, followed by a copy of the .PDB files to the directory. I also copy the DLL to a local directory that I can point the Plugin Registration Tool at.
The side effect of this is that the Plugin Registration tool loses its mind, and apparently a cached connection to the server. If you just jump over to it and try to update the assembly with the Update Button, it will lock up.
The solution…Refresh first.
By refreshing, it takes an extra few seconds as it reconnects to IIS, but that’s what you need to do to keep it working. After that you can click Update, point it to your re-built DLL file, and you’re all set.
In 4.0 i used to be able to just Update the Assembly directly, and that process would take the extra few seconds while it reconnected to IIS, but that now causes a lockup. No big deal, but was pretty annoying the first few times I did it.
After the Refresh, you can now switch back to VS2010, select Debug, Attach to Process, and select the W3WP process.
Hope this helps if you are seeing lockups with the Plugin Registration Tool.