In this blog, I will describe how to debug the XrmToolBox plugin project which we created in Part 1. If you have not read my first blog I recommend you read it first.
This is my second blog in the series of 4 blogs, below are the links to other blogs
- Create XrmToolBox Plugin – Part 1: Set-up Visual Studio and create a basic plugin
- Create XrmToolBox Plugin – Part 3: Package your plugin
- Create XrmToolBox Plugin – Part 4: Setup build definition release for CI and CD
- Visual Studio 2017.
- You have created the visual studio project and configured as mentioned in Part 1 of this series.
Step 1: Add post-build command to your VS project to create a Plugin folder and copy your plugin assemblies to this folder.
if $(ConfigurationName) == Debug (
IF NOT EXIST Plugins mkdir Plugins
move /Y SampleXrmToolBoxPlugin.dll Plugins
move /Y SampleXrmToolBoxPlugin.pdb Plugins
Step 2: Configure XrmtoolBox.exe to start on debugging by setting the XrmToolBox.exe path in “Start external program”. This exe can be found at “<<your plugin project location>>\bin\Debug\XrmToolBox.exe”. If you don’t see this exe in debug folder, just rebuild your plugin.
/overridepath:. – it will tell XrmToolBox.exe to look for the plugin in the debug folder of your project
/connection:”<<crm connection name>>” – the name of the CRM connection you have saved in XrmToolBox. It saves debugging time by automatically connecting to CRM instance.
/plugin:”<<plugin name>>” – the Name of your plugin as you have specified in “MyPlugin.cs” file
Step 3: Add XrmToolBox.exe.config file
You need to add this file to your project and set its property “Copy to Output Directory” to “Copy always”. This file can be found at
- “<<your plugin project location>>\packages\XrmToolBoxPackage.1.2018.6.25\lib\net462. If you don’t find config file here go to next step. This path will change as per XrmToolBox package version installed on your machine and .net version.
- Download XrmToolBox (same version as XrmToolBoxPackage )from here and copy its config file in your project.
Step 4: copy dependencies to XrmToolBox.exe.config
- Copy all missing dependencies from “app.config” file to “XrmToolBox.exe.config”.
- If you get any missing dependencies error when you debug your project, it needs to be added here.
Now you are all set to debug your project.
Hope it helps .