Tue, 05/17/2022 - 15:22 By Lloyd Sebag Contributor Lloyd Sebag

Dynamics 365 SDK Tool with PowerShell:

Hey All, 

I share with you a nice trick that could help. 

For the ancients Dynamics 365 workers like me, you remember that we had the possibility to download the CRM SDK locally in which was the dev tools offered by Microsoft, such as the Plugin Registration Tool.

However, for quite a few years now, it is no longer possible to download the SDK. But where are the tools?
Some will answer in XrmToolBox, and some will say in packaged Nuget. Both answers are correct (almost), but they do not allow us to know how we can find these tools, locally on our laptop, without depending on XrmToolBox or a Visual Studio project.

Indeed, one solution would be to simply create an empty VS project and reference the nugget package there. So it would upload to the project's Packages directory and all good. But if we don't want to depend on Visual Studio, what can we do?

Microsoft offers us a great trick, based on a small PowerShell script. Here is the original post: Download tools from NuGet

Just follow these steps:

  • Create an empty directory on your Laptop where you want to have your tools.
  • Create a file: UpdateNugetPackages.ps1

You will get something like this. 

Dynamics 365 SDK Tool with PowerShell

  • Add the following code.
[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

##
##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

##
##Download CoreTools
##
./nuget install  Microsoft.CrmSdk.CoreTools -O .\Tools
md .\Tools\CoreTools
$coreToolsFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.CoreTools.'}
move .\Tools\$coreToolsFolder\content\bin\coretools\*.* .\Tools\CoreTools
Remove-Item .\Tools\$coreToolsFolder -Force -Recurse

##
##Download Configuration Migration
##
./nuget install  Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf -O .\Tools
md .\Tools\ConfigurationMigration
$configMigFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf.'}
move .\Tools\$configMigFolder\tools\*.* .\Tools\ConfigurationMigration
Remove-Item .\Tools\$configMigFolder -Force -Recurse

##
##Download Package Deployer 
##
./nuget install  Microsoft.CrmSdk.XrmTooling.PackageDeployment.WPF -O .\Tools
md .\Tools\PackageDeployment
$pdFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PackageDeployment.Wpf.'}
move .\Tools\$pdFolder\tools\*.* .\Tools\PackageDeployment
Remove-Item .\Tools\$pdFolder -Force -Recurse

##
##Remove NuGet.exe
##
Remove-Item nuget.exe
  • And that's it. Then you just have to double click on the file to launch the PowerShell script which will itself download the latest versions of the SDK tools, locally, in your folder!

fff

Dynamics 365 SDK Tool with PowerShell

Add new comment

Image CAPTCHA
Enter the characters shown in the image.