Download Plugin Registration Tool for Dynamics 365 CRM using PowerShell

If you are new to plugin development, you must’ve learnt by now that you’ll need to download and install a Plugin Registration Tool in order to register your plugin with the Dynamics 365 environment you are working on.

In case you are on your own and someone hasn’t given you the zip file already, here’s how you can start from scratch. 😊

Download Plugin Registration Tool using PowerShell

Here’s how you start from the very beginning.

  1. If you do a quick Google Search, you might find someone must’ve already uploaded a Plugin Registration Tool somewhere, but in case you want to get it from Microsoft’s official website, here’s the link to Microsoft Docs – https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/download-tools-nuget?view=op-9-1&viewFallbackFrom=op-9-1%3FWT.mc_id%3DDX-MVP-5003911
    Then, you can directly navigate to the Plugin Registration Tool segment by clicking on the highlighted link below


  2. In Plugin Registration Tool, you can simply click on the Download Package button


    This file Nuget file will be downloaded to your machine –

  3. Now, open PowerShell in Admin mode –

  4. Now, write the below code in PowerShell [Make sure you are pointing to the directory where you want to install the Nuget.exe]
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" $targetNugetExe = ".\nuget.exe" Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe Set-Alias nuget $targetNugetExe -Scope Global -Verbose

    It’ll look like this when you type and press Enter, after a few moments when it’s completed downloading, you’ll be in the below state –

  5. Now, Microsoft Docs article above lists the PS Script to download all the Tools, but from that, if you want to only Download Plugin Registration Tool for now, that’s fine! You can just write the below PS Script and leave the rest –

    PS Script for Plugin Registration Tool only –
    ## ##Download Plugin Registration Tool ## ./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools md .\Tools\PluginRegistration $prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'} move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration Remove-Item .\Tools\$prtFolder -Force -Recurse



    And when you press enter, it’ll setup the same and this will be your completed state –

  6. And you are done! Plugin Registration Tool has been downloaded
    And since we only Downloaded the Plugin Registration Tool and nothing else, only Plugin Registration Tool folder will be seen

  7. And here’s your Plugin Registration Tool


Hope this was helpful! Here are some more Dynamics 365 posts which you might be interested in –

  1. Dynamics 365 Storage Utilization | Dataverse Storage | Power Platform Admin Center
  2. Use Hierarchy in Roll Up Fields in Dynamics 365 CRM
  3. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  4. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  5. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
  6. Import lookup referencing records together in Dynamics 365 CRM | [Linking related entity data during Excel Import]
  7. Mailbox Alerts Hide/Show behavior in Dynamics 365 CRM
  8. Excel Importing Notes (Annotation) entity in Dynamics 365 CRM
  9. Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE
  10. Call Azure Function from Dynamics 365 CRM using Webhooks
  11. Show Ribbon button only on record selection in Dynamics CRM
  12. Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM

Thank you!!

Enable Plug-in Profiler in Settings area in SiteMap in Dynamics 365 | [Quick Tip]

In case you are wondering why Plug-in Profiles under Extensions and Extensions itself don’t appear in your SiteMap because you want to debug from the Persist To Entity option?

But your Settings area still looks like this and don’t see Plugin-Profiles?

Install Plugin Profiler

You’ll need to install Plugin Profiler.

  1. Open Plugin Registration Tool and login to the environment.
    You should see an Install Profiler button. That’s the reason the Profile is not yet installed on the environment and it’s now showing in SiteMap.


  2. Now, when you click on Install Profiler, it’ll install the Profiler to the environment.


  3. Once this is installed, you’ll see it show in the SiteMap in Settings area.


  4. Also, if you notice the Solutions, a Managed Solution would also be installed which will SiteMap (it indicates the update that Plugin Profiles has been added to the SiteMap)


  5. Also, if you Uninstall the Plugin Profiler, the Managed Solution will be removed and also this will take Plug-in Profile off the SiteMap.
  6. Also, there’s another way to remove the Plugin Profiler – Workaround to get Plugin Profiler from the Unified Interface in D365 CE

Hope this was helpful!

Here are some more Dynamics 365 Admin related posts you might want to check –

  1. Disable Recent Records from Dynamics 365 Lookup Control | Model-Driven Apps [Quick Tip]
  2. Language format for Whole Number field in Dynamics 365 CE
  3. Custom Help Pages and Guided Tasks for Unified Interface in Dynamics 365
  4. Make Managed fields Required in Dynamics 365 – Managed Properties Error [Workaround] | D365 CE Quick Tip
  5. Sign up for a Dynamics 365 Project Operations (Lite Deployment) environment and provision a new instance | Power Platform
  6. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  7. Show custom ribbon button based on Security Role of the logged in User in Dynamics 365 | Ribbon Workbench in XrmToolbox
  8. Make On-Demand Flow to show up in Dynamics 365 | Power Automate

Thank you!

Workaround to get Plugin Profiler from the Unified Interface in D365 CE

Developers like me, often need to Profile the Plugin so see what logic you are implementing and this is pretty common in the development lifecycle. But, Let’s say you don’t have the classic UI at your disposal and need to download the Profiler from the Unified Interface itself – Here’s a little detour you’ll need to take to get it right.

Alternatively, using Persist To Entity is also preferred. But example – if you have a plugin on Create and on PreOperation, you won’t want to record to be created, you can go with the below –

Ease of the Classic UI

On the classic UI, you would get the Profiled file correctly just by Download Log File button on the interface itself.

classicProfiler

And the file has correct data starting with –
startingWIth

And ending with
endingWith.png

Profiler Message on the Unified Interface

As of now, the message pop-up for the profiled plugin will give you this –
currentUCIMessage.png

And the file has this –

currentUCIFile

And the Plugin Registration Tool doesn’t understand this! You’ll get this parsing error if you try –
parseError
parseErrorMessage

Turn On Exception Logging

Before that, you can check this post on how you can quickly go to the classic UI’s Settings area here – D365 Quick Tip: Shortcut to Settings from the Unified Interface

To be able to capture these details in the Plugin Profile entity, enable Plug-in and custom workflow activity tracing from the System Settings as shown below
turnOnLogging

You can’t add Plug-in Trace Logs to UCI

  1. Smarter way would be to add the Plug-in Trace Log entity to the UCI App itself and not having to go back to the classic UI. Unfortunately, you can’t do that.
    cantAddToUCI.png
    With that, we will have to go back to the Classic UI’s Settings > Plugin-In Profile Area to get out Profiled Log File.

Plug-In Trace Log

  1. Assuming you are back in the classic UI (maybe keep this open in another tab)
    Open the Trace Log record
    openProfileRecord.png
  2. Scroll down to the very bottom to find the Exception Details
    profiledData.png
  3. Now, copy that to the text file and attach it in the Plugin Registration Tool
    correctProfileFile.png
  4. This should work and you won’t get an error
    attached.png

Phew! I know this is lengthy. But we hope this will soon be eased 🙂

Hope this helps you!

Delete Async Plugin Logs if plugin succeeds, save D365 storage space

Let’s see how we can efficiently manage D365 storage without bloating the storage with data that you might not need.

In my opinion, we don’t really need to know that the background process was successful or not, we typically care for what failed.

So, from an Asynchronous plugin standpoint, the logs in D365 is registered in the System Jobs and they create a ton of System Events if you are Importing data in D365 and your Async process is on the create of such records.

sysjobs

Check your Async plugin step

  1. Now, you can preserve this storage space by choosing to Delete the Async plugin logs.
  2. In the screenshot below, you can see an option to ‘Delete AsyncOperation is StatusCode = Successful’
    deletelog

In this case, the System Jobs for the will not be created, thus, saving you valuable storage space if your plugin is run frequently.

Hope this helps.

D365 Quick Tip: Rather Uninstall Plugin Profiler from the D365 Solutions

Often, I get annoyed when I finish debugging the plugin and want to uninstall the Plugin Profiler from the Plugin Registration Tool so that users can quickly go ahead and test out the fix, it takes longer in the tool for the Profiler to be uninstall.

uninstallFromTool

And if at times, there are bandwidth issues, the uninstall just times out giving you this error.

error

Solutions in D365

Same thing is available in your organization’s Solution as well.

Select it and Delete it. It happens in less time.
uninstallFromSolutions
confirm

As a test, I simply closed the browser window and solution was deleted later when I logged back in. Since it happens on the server.

Hope this quick tip saves a few minutes. 😊