Click connect to the Microsoft Dynamics CRM Server, you should see a list of available organizations that you belong to in the Connections pane.

Register a Plug-in Assembly

Select an organization in the Connections pane.From the Register menu, and then click Register New Assembly.

In the Register New Plugin dialog box, click the ellipses […] button to select the complied plugin dll.

Click Register Selected Plugins. Click OK to close the dialog boxes.

Register the Plug-in for an Event

Select (installed Assembly) plugin in the tree view, move to the Register menu, and then click Register New Step.Complete the Register New Step dialog box as shown in the following figure.

If you want to register the plug-in to execute immediately (for testing purposes), select Synchronous.

Click Register New Step.

Expand the (installed Assembly) plugin node to see the plug-in and step nodes you created If you registered the plug-in to run asynchronously, and did not select the Delete AsyncOperation if StatusCode = Successful option on the Register New Step form, there will be a new system job named “FollowupPlugin: Create of account”. To view the related system job, click Settings, and then click System Jobs. Double-click the system job previously mentioned.

Register New Image

Select (installed Assembly) plugin in the tree view, move to the Register menu, and then click Register New Image.

Complete the Register New Image (Pre or Post) dialog box as shown in the following figure.

Final Tree View in the Plug-in Registration Tool should now look like this:

The following table shows how the equivalent values used in the Plugin Registration tool:

RegisterFile.crmregister values

Plugin Registration Tool values

PreOutsideTransaction

PreValidation

PreInsideTransaction

PreOperation

PostOutsideTransaction

PostOperation

Install Profiler

From the plugin registration tool, click the Install Profiler. (if "pluginprofiler.solution" package is not exported in your solution, you can't install it).

Once it finished, make sure Plugin Profiler exists.

Select the plugin step needed to debug, click Profiler to enable profiling. Or Rigth click on step and click on "Start Profiling".

Navigate to CRM system, perform the account creation which will trigger the plugin to be execute. Download the error log file (ErrorDetails.log) and save in desktop.

Run the visual studio solution, attach debug process named "PluginRegistration". Set a break point in the code.

Open the plugin registration tool, click the Debug button.

Browse the profile location with the erro log we downloaded in item 4. Choose the assembly location and click start plugin execution.

System will auto step into visual studio breakpoint line.

Difference between Secure and Unsecure Configuration

Secure Configuration

UnSecure Configuration

The Secure Configuration information could be read only by CRM Administrators.(Eg: Restricted data from normal user could be supplied here)

Let's assume that your solution is unmanaged and it contain a plugin, later the solution was exported as managed Solution to another environment. In this scenario, the secure configuration information would nOT be available in the new environment. The simple reason behind this is to provide more security to the contents of secure Configuration.

Unsecure configuration information could be read by any user in CRM. Remember its public information (Eg: Parameter strings to be used in plugin could be supplied here)

Let's assume that your solution is unmanaged and it contain a plugin, later the solution was exported as managed Solution to another environment. In this scenario, the unsecure configuration values would be available in the new environment.

Plug-in Isolation, Trusts, and Statistics

The execution of plug-ins and custom workflow activities in an isolated environment.

In this isolated environment, also known as a sandbox, a plug-in or custom activity can make use of the full power of the Microsoft Dynamics CRM SDK to access the organization web service.

Access to the file system, system event log, certain network protocols, registry, and more is prevented in the sandbox.

Sandbox plug-ins and custom activities do have access to external endpoints like the Windows Azure cloud.

Trusts
Registering the plug-ins in the sandbox, known as partial trust, or outside the sandbox, known as full trust.

By changing this registry key value, you can change the web access for sandboxed plug-ins.

The sandbox processing service role defaults to outbound calls being enabled. If you do not want to permit outbound calls by setting the following registry key to 1 (DWORD) on the server that hosts the sandbox processing service role. Next, restart the Microsoft Dynamics CRM Sandbox Processing Service.

Sync vs Async plugin
Synchronous processing execute immediately - Asynchronous processing are queued.
Synchronous plugin the platform core operation need to wait for the completion of plugin execution.
so you can get better performance by registering a plugin to execute asynchronously.

A scenario where the plugin is used to transfer the contact information from the CRM system to a contact mailing system.

Sync plugin - The voter will be copied to Mailing system as soon as it is created in CRM. If it fails in Mailing system, you'll get the error then and there. But the CRM system will wait till contact gets created in Mailing system, thus making each transaction slow. This delay may be noticeable to the CRM user depending upon the amount of delay.

Async Plugin - After the contact is created in CRM, it will be queued and send to Mailing system. It may take more time for this contact to get created in Mailing depending on queue status, other resource availability, etc. But here the CRM system will not wait and move on with the processing. The user creating the contact will not get any delay in saving the contact record.