One of the biggest frustrations that I have found as a
Dynamics CRM developer is the lack of a new release of the Dynamics CRM
Developer Toolkit. Initially, the Developer Toolkit only worked with Visual
Studio 2010 in the version that shipped with the Dynamics CRM 2011 SDK. The
Dynamics CRM 2013 SDK then included a Developer Toolkit for both Visual Studio
2010 and 2012. But shortly afterwards, Visual Studio 2013 was released and
there was no version of the Developer Toolkit forthcoming for Visual Studio
2013. At the date of writing, we are currently on Visual Studio 2015, with a
newer version already being primed for release in the near version. So
essentially, Microsoft have not released a Developer Toolkit for Visual Studio
2013 and 2015 and for Dynamics CRM 2015 or 2016. I therefore decided to take
action and modify the latest Dynamics CRM Developer Toolkit to work with Visual
Studio 2013 or 2015 and with Dynamics CRM 2015 or 2016.
If you do not have the time to go through the steps below to
do this yourself, here is the download:
For those who are interested, here are the steps that I
undertook to achieve this:
Download the Dynamics CRM 2013, 2015 and 2016 SDK
You are going to need to download the latest version of the
Dynamics CRM SDK for versions 2013, 2015 and 2016. We will modify the Developer
Toolkit within the Dynamics CRM 2013 SDK and we will also replace some of the
assemblies and executables in the Developer Toolkit with those in the Dynamics
CRM 2015 and 2016 SDK. If you are still using Dynamics CRM 2013, you will only
need to download the Dynamics CRM 2013 SDK and if you are still using Dynamics
CRM 2015, you will not need to download the Dynamics CRM 2016 SDK. Here are the
locations for downloading the Dynamics CRM SDK installers at the time of
writing:
Please note that you do not need the UII Framework installer
that is also available at these links. Please note also that these links are
culture specific to the UK and you can modify the culture in the links to your
preferred culture, e.g. change en-gb to
en-us.
Decompile Dynamics CRM Developer Toolkit MSI with MSI Executable
The next step will be to use msiexec.exe to decompile the Developer Toolkit MSI. I have decided
to extract the MSI created for Visual Studio 2012, i.e. CrmDeveloperToolsVS12_Installer.msi. This should be located in the SDK\Tools\DeveloperToolkit
folder where you extracted the SDK. Use the following command line to extract
the MSI:
msiexec.exe /a <PathToSdk>\SDK\Tools\DeveloperToolkit\CrmDeveloperToolsVS12_Installer.msi
/gb targetdir=<YourPreferredTargetPath>\MsiExtract
Install WiX Toolset
For the next few steps, you will need to install the WiX
Toolset if you haven’t already done so. You can download the latest version
from here:
Decompile Dynamics CRM Developer Toolkit MSI with WiX Toolset
We are now going to decompile
the Developer Toolkit MSI using dark.exe,
which is the WiX Toolset decompiler. Firstly, we need to extract the MSI and
create a WXS file:
“%programfiles(x86)%\WiX Toolset vx.x\bin\dark.exe” <PathToSdk>\SDK\Tools\DeveloperToolkit\CrmDeveloperToolsVS12_Installer.msi
–o <YourPreferredTargetPath>\WiXExtract\Product.wxs
Next, we need to extract the assemblies from the MSI:
“%programfiles(x86)%\WiX
Toolset vx.x\bin\dark.exe” <PathToSdk>\SDK\Tools\DeveloperToolkit\CrmDeveloperToolsVS12_Installer.msi
–x <YourPreferredTargetPath>\WiXExtract
In <YourPreferredTargetPath>\WiXExtract
you should now have a Product.wxs
file and three folders:
·
Binary
·
File
·
Icon
Rename Files in the Binary Folder
Next, we are going to rename files in the <YourPreferredTargetPath>\WiXExtract\Binary
folder:
·
Rename DefBannerBitmap
to DefBannerBitmap.bmp
·
Rename NewFldrBtn
to NewFldrBtn.bmp
·
Rename UpFldrBtn
to UpFldrBtn.bmp
·
Rename InstallUtil
to InstallUtil.ibd
·
Rename MSVBDPCADLL
to MSVBDPCADLL.ibd
·
Rename VSDNETCFG
to VSDNETCFG.ibd
Edit the Product WXS File
Now we are going to edit the Product.wxs file that you created at <YourPreferredTargetPath>\WiXExtract\Product.wxs using
dark.exe. Open the Product.wxs file
in an editor of your choice, such as Visual Studio 2015 and make the following
changes:
On line 5 through to 10, change the SourceFile variable to the correct details:
Before:
<Binary Id="InstallUtil" SourceFile="FILE NOT EXPORTED, USE THE dark.exe -x OPTION TO EXPORT BINARIES" />
<Binary Id="MSVBDPCADLL" SourceFile="FILE NOT EXPORTED, USE THE dark.exe -x OPTION TO EXPORT BINARIES" />
<Binary Id="VSDNETCFG" SourceFile="FILE NOT EXPORTED, USE THE dark.exe -x OPTION TO EXPORT BINARIES" />
<Binary Id="DefBannerBitmap" SourceFile="FILE NOT EXPORTED, USE THE dark.exe -x OPTION TO EXPORT BINARIES" />
<Binary Id="UpFldrBtn" SourceFile="FILE NOT EXPORTED, USE THE dark.exe -x OPTION TO EXPORT BINARIES" />
<Binary Id="NewFldrBtn" SourceFile="FILE NOT EXPORTED, USE THE dark.exe -x OPTION TO EXPORT BINARIES" />
After:
<Binary Id="InstallUtil" SourceFile="Binary\InstallUtil.ibd" />
<Binary Id="MSVBDPCADLL" SourceFile="Binary\MSVBDPCADLL.ibd" />
<Binary Id="VSDNETCFG" SourceFile="Binary\VSDNETCFG.ibd" />
<Binary Id="DefBannerBitmap" SourceFile="Binary\DefBannerBitmap.bmp" />
<Binary Id="UpFldrBtn" SourceFile="Binary\UpFldrBtn.bmp" />
<Binary Id="NewFldrBtn" SourceFile="Binary\NewFldrBtn.bmp" />
On line 350, change the SourceFile
variable to the correct details:
Before:
<Icon Id="_853F67D554F05449430E7E.exe" SourceFile="FILE NOT EXPORTED, USE THE
dark.exe -x OPTION TO EXPORT BINARIES" />
After:
<Icon Id="_853F67D554F05449430E7E.exe" SourceFile="Icon\_853F67D554F05449430E7E.exe" />
Perform a Replace operation within the file,
replacing Source="SourceDir\ with Source=".
Perform a Replace
operation within the file, replacing
"Microsoft Dynamics CRM
Developer Toolkit for Visual Studio 2012"
With
"Microsoft Dynamics CRM
Developer Toolkit for Visual Studio 2015".
Go to line
376 and replace
Key="Software\Microsoft\VisualStudio\11.0\Setup\VS"
With
Key="Software\Microsoft\VisualStudio\14.0\Setup\VS".
Go to line
17 and replace
Value="[VISUALSTUDIO_PATH]Common7\IDE\Extensions\Microsoft\Dynamics
CRM 2011 Developer Tools\1.0"
With
Value="[VISUALSTUDIO_PATH]Common7\IDE\Extensions\Microsoft\Dynamics
CRM 2016 Developer Tools\1.0".
Save and close the Product.wxs
file.
Create the Windows Installer XML Setup Project
Create a new Windows Installer XML Setup Project in Visual
Studio 2015:
Close Visual Studio 2015 and copy all the contents of the <YourPreferredTargetPath>\WiXExtract
folder into the <YourPreferredTargetPath>\DeveloperToolkitSetupProject\DeveloperToolkitSetupProject
folder, replacing the existing contents if there are files with matching names,
e.g. replacing Product.wxs.
Now you can reopen the Visual Studio Solution.
We now need to add the
folders to our project as follows:
In Solution Explorer, click Show
All Files:
Right-click the Binary, File and Icon folders and
select Include in Project:
Now you can save your Visual Studio Solution.
Modify the VSIX Package
Make sure that you have installed a tool that can open
archive files, e.g. 7-zip from http://7-zip.org/
Open the <YourPreferredTargetPath>\MsiExtract\Visual
Studio folder and use your preferred tool, e.g. 7-zip, to open the Microsoft.CrmDeveloperTools.vsix
file.
Copy extension.vsixmanifest
to a location of your choice.
Edit extension.vsixmanifest
using your preferred editor, e.g. Notepad.
Replace all
instances of
Version=”[11.0,12.0)”
With
Version="[14.0,15.0)".
Replace all
instances of
Dynamics CRM 2013
With
Dynamics CRM 2016
or your preferred Dynamics CRM version.
Replace all
instances of
Visual Studio 2012
With
Visual Studio 2015
or your preferred Visual Studio version.
You will then need to replace the extension.vsixmanifest file in the Microsoft.CrmDeveloperTools.vsix
archive.
Keep a copy of both the extension.vsixmanifest
file and the Microsoft.CrmDeveloperTools.vsix
file for later use.
Modify the Microsoft Dynamics CRM Developer Tools Assembly
Before starting this step, make sure you have .NET Framework 2.0, .NET Framework 3.5 and .NET
Framework 4.0 or .NET Framework 4.5
installed, which should all be standard features that you can add for Windows.
This is in order to reference mscorlib.dll,
version 2.0.0.0. You will also need
to install .NET Framework 1.0, which you download from here:
Please note that the .NET
Framework 1.0 does not install on machines with a 64 bit version of Windows
running. To get to the mscorlib.dll version 1.0.3300.0, you will need to do
the following:
Extract the .NET Framework 1.0 executable as follows:
dotnetfx.exe
/C /T:<YourPreferredTargetPath>
In the destination folder, use WiX Toolset’s dark.exe to get
the files from the MSI:
“%programfiles(x86)%\WiX
Toolset vx.x\bin\dark.exe” <PathToNetFxMsi>\netfx.msi
–x <YourPreferredTargetPath>
In the <YourPreferredTargetPath>\File
folder, find the file called FL_mscorlib_dll_____X86.3643236F_FC70_11D3_A536_0090278A1BB8
and rename it to mscorlib.dll.
You will now have the mscorlib.dll
required to reference version 1.0.3300.0.
Alternatively, if you have Visual Studio 2010, 2012 and 2013
as well as 2015, then all the required assemblies should then be available and
you do not need to go through the effort of installing the .NET Frameworks if
they are not installed.
You will need to install a tool such as .Net Reflector or Telerik
JustDecompile to edit the assembly. I would recommend the Telerik JustDecompile tool as the .Net Reflector tool seems to clash with
the Dynamics CRM Developer Toolkit in Visual Studio.
Open the <YourPreferredTargetPath>\MsiExtract\Visual
Studio folder and then open the Microsoft.CrmDeveloperTools.dll
using your preferred tool.
You may get requests to advise where referenced assemblies
reside. It is very important that you specify these. You will find Microsoft.Xrm.Sdk.dll
in <YourPreferredTargetPath>\MsiExtract\Visual Studio.
Next, in the Tree View,
expand Microsoft.CrmDeveloperTools,
expand Microsoft.CrmDeveloperTools.dll
and then expand References.
Right-click on mscorlib, Version 1.0.3300.0, which
should have a warning triangle next to it and click Locate Assembly.
Now you need to locate the
mscorlib.dll that you extracted from the .NET Framework 1.0 installer earlier.
Make sure that the warning
triangle disappears.
Now we are going to update
the assembly to work with Visual Studio 2015.
Perform a search for the term
11.0:
Double-click the result found
in the search:
At the top of the screen,
select Plugins and then select Reflexil.
Select line 04, then
right-click the line and click Edit.
In the Operand, find where it says 11.0
and change it to 14.0 and then click
Update.
In the Tree View, at the very
top level of the Tree, right-click on Microsoft.CrmDeveloperTools,
select Reflexil vx.x and then click Save as…
Save the file with the suggested name and then move the file
to the same location where you saved the extension.vsixmanifest
file and the Microsoft.CrmDeveloperTools.vsix
file. Change the File Name to Microsoft.CrmDeveloperTools.dll after
you have moved the file.
Modify the Installer Actions Module Assembly
Open the <YourPreferredTargetPath>\MsiExtract\Visual
Studio folder and then open the InstallerActionsModule.dll
using your preferred tool.
Perform a search for the term
11.0 and replace with 14.0.
For the first search result, open the Reflexil Plugin, go to line 11, change 11.0 to 14.0 and then
click Update.
For the second search result,
go to line 11, change 11.0 to 14.0 and then click Update.
Right-click on InstallerActionsModule at the tope of the
Tree in the Tree View and then click Save
as…
Save the file with the suggested name and then move the file
to the same location where you saved the Microsoft.CrmDeveloperTools.dll,
the extension.vsixmanifest file and
the Microsoft.CrmDeveloperTools.vsix
file. Change the File Name to InstallerActionsModule.dll after you
have moved the file.
Replace the Target Files with the Modified Files
Next, you will need to open your WiX Setup Project in Visual
Studio. You will now need to search for the corresponding modified file by
searching for its name and then use the identity to find the file in the Files folder and replace that file with
your modified file.
Open the <YourPreferredTargetPath>\DeveloperToolkitSetupProject\DeveloperToolkitSetupProject\File
folder and copy & paste your four modified files into this folder:
·
extension.vsixmanifest
·
InstallerActionsModule.dll
·
Microsoft.CrmDeveloperTools.dll
·
Microsoft.CrmDeveloperTools.vsix
Back in Visual Studio, in your Product.wxs file, perform a search for each of the files above and
grab the identity as follows:
extension.vsixmanifest:
Search for extension.vsixmanifest
in the Product.wxs file:
On line 70, you will find the following:
<Component Id="C__5321CEFF17F6451190F787E8AA1DC739" Guid="{34E8D4B7-42F9-C936-CA9E-F355B0D7130F}">
<File Id="_5321CEFF17F6451190F787E8AA1DC739" Name="extension.vsixmanifest" KeyPath="yes" ShortName="EXTENS~1.VSI" DiskId="1" Source="File\_5321CEFF17F6451190F787E8AA1DC739" />
</Component>
Copy the file identity _5321CEFF17F6451190F787E8AA1DC739.
Search for _5321CEFF17F6451190F787E8AA1DC739 in the <YourPreferredTargetPath>\DeveloperToolkitSetupProject\DeveloperToolkitSetupProject\File
folder.
Delete the file that is
found.
Clear the search result and find the extension.vsixmanifest file in the list.
Rename the extension.vsixmanifest
file to _5321CEFF17F6451190F787E8AA1DC739.
InstallerActionsModule.dll:
Search for InstallerActionsModule.dll in the Product.wxs file:
On line 139, you will find the following:
<Component Id="C__CD555B4F255B4F95980277DD499773C6" Guid="{F168C13C-8D98-78D0-31B1-66B5CC6DBAD6}">
<File Id="_CD555B4F255B4F95980277DD499773C6" Name="InstallerActionsModule.dll" KeyPath="yes" ShortName="INSTAL~1.DLL" Assembly=".net" AssemblyManifest="_CD555B4F255B4F95980277DD499773C6" AssemblyApplication="_CD555B4F255B4F95980277DD499773C6" DiskId="1" Source="File\_CD555B4F255B4F95980277DD499773C6" />
</Component>
Copy the file identity _CD555B4F255B4F95980277DD499773C6.
Search for _CD555B4F255B4F95980277DD499773C6 in the <YourPreferredTargetPath>\DeveloperToolkitSetupProject\DeveloperToolkitSetupProject\File
folder.
Delete the file that is
found.
Clear the search result and
find the InstallerActionsModule.dll
file in the list.
Rename the InstallerActionsModule.dll
file to _CD555B4F255B4F95980277DD499773C6.
Microsoft.CrmDeveloperTools.dll:
Search for Microsoft.CrmDeveloperTools.dll in the Product.wxs file:
On line 144, you will find the following:
<Component Id="C__D20173011E1946C9B8096A9F8190D92A" Guid="{7144D42D-6A2B-9FF1-A668-0C04D8D420E1}">
<File Id="_D20173011E1946C9B8096A9F8190D92A" Name="Microsoft.CrmDeveloperTools.dll" KeyPath="yes" ShortName="MICRO~30.DLL" Assembly=".net" AssemblyManifest="_D20173011E1946C9B8096A9F8190D92A" AssemblyApplication="_D20173011E1946C9B8096A9F8190D92A" DiskId="1" Source="File\_D20173011E1946C9B8096A9F8190D92A" />
</Component>
Copy the file identity ="_D20173011E1946C9B8096A9F8190D92A.
Search
for ="_D20173011E1946C9B8096A9F8190D92A in the <YourPreferredTargetPath>\DeveloperToolkitSetupProject\DeveloperToolkitSetupProject\File
folder.
Delete the file that is
found.
Clear the search result and
find the Microsoft.CrmDeveloperTools.dll
file in the list.
Make a second copy of the Microsoft.CrmDeveloperTools.dll file.
Rename the Microsoft.CrmDeveloperTools.dll
file to ="_D20173011E1946C9B8096A9F8190D92A.
On line 264, you will find the following:
<Component Id="C__103D3DE220164427897D6503F265BDE5" Guid="{DD88B855-AF14-1133-0EEF-3712536F7BA5}">
<File Id="_103D3DE220164427897D6503F265BDE5" Name="Microsoft.CrmDeveloperTools.dll" KeyPath="yes" ShortName="MICROS~6.DLL" Assembly=".net" AssemblyManifest="_103D3DE220164427897D6503F265BDE5" AssemblyApplication="_103D3DE220164427897D6503F265BDE5" DiskId="1" Source="File\_103D3DE220164427897D6503F265BDE5" />
</Component>
Copy the file
identity _103D3DE220164427897D6503F265BDE5.
Search for _103D3DE220164427897D6503F265BDE5 in the <YourPreferredTargetPath>\DeveloperToolkitSetupProject\DeveloperToolkitSetupProject\File
folder.
Delete the file that is
found.
Clear the search result and
find the Microsoft.CrmDeveloperTools -
Copy.dll file in the list.
Rename the Microsoft.CrmDeveloperTools - Copy.dll
file to _103D3DE220164427897D6503F265BDE5.
Compile the Visual Studio WiX Setup Project
Go ahead and compile the Visual Studio Solution.
You will more than likely get two errors:
Severity
|
Code
|
Description
|
Project
|
File
|
Line
|
Suppression State
|
Error
|
|
The
FileSearch/@ShortName attribute cannot be specified when attribute LongName
is present.
|
DeveloperToolkitSetupProject
|
Product.wxs
|
380
|
|
Error
|
|
The FileSearch/@ShortName
attribute cannot be specified when attribute LongName is present.
|
DeveloperToolkitSetupProject
|
Product.wxs
|
385
|
|
To get rid of these errors, simply
remove the ShortName parameters and
the respective values.
Compile the Visual Studio Solution
again.
You will
now get a new error:
Severity
|
Code
|
Description
|
Project
|
File
|
Line
|
Suppression State
|
Error
|
|
Component/@Id='C__D325117EC0E8F14DB8B5285A80115139'
has a @Guid value '{5CB4F8DD-3B54-AD3F-296B-EBDBDC2648A7}' that duplicates
another component in this package. It is recommended to give each component
its own unique GUID.
|
DeveloperToolkitSetupProject
|
Product.wxs
|
147
|
|
The solution is simple. At line
147, change the GUID from 5CB4F8DD-3B54-AD3F-296B-EBDBDC2648A7 to another GUID
of your choice. You can use the built-in GUID generator in Visual Studio to get
a new GUID.
Before:
<Component Id="C__D325117EC0E8F14DB8B5285A80115139" Guid="{5CB4F8DD-3B54-AD3F-296B-EBDBDC2648A7}">
<File Id="_D325117EC0E8F14DB8B5285A80115139" Name="Microsoft.Crm.Sdk.Proxy.DLL" KeyPath="yes" ShortName="MICRO~31.DLL" Assembly=".net" AssemblyManifest="_D325117EC0E8F14DB8B5285A80115139" AssemblyApplication="_D325117EC0E8F14DB8B5285A80115139" DiskId="1" Source="File\_D325117EC0E8F14DB8B5285A80115139" />
</Component>
After:
<Component Id="C__D325117EC0E8F14DB8B5285A80115139" Guid="{A603AD53-2FD8-469F-94C4-245A6197C605}">
<File Id="_D325117EC0E8F14DB8B5285A80115139" Name="Microsoft.Crm.Sdk.Proxy.DLL" KeyPath="yes" ShortName="MICRO~31.DLL" Assembly=".net" AssemblyManifest="_D325117EC0E8F14DB8B5285A80115139" AssemblyApplication="_D325117EC0E8F14DB8B5285A80115139" DiskId="1" Source="File\_D325117EC0E8F14DB8B5285A80115139" />
</Component>
I used Guid="{A603AD53-2FD8-469F-94C4-245A6197C605}".
However, when you compile the
Visual Studio Solution, you will get two new errors:
Severity
|
Code
|
Description
|
Project
|
File
|
Line
|
Suppression State
|
Error
|
|
ICE30: The target
file 'MICRO~12.DLL|Microsoft.Crm.Sdk.Proxy.dll' is installed in
'[TARGETDIR]\Visual Studio\' by two different components on an LFN system:
'C__646D85FDD00C4F6CBCE0E424030A8F09' and 'C__D325117EC0E8F14DB8B5285A80115139'.
This breaks component reference counting.
|
DeveloperToolkitSetupProject
|
Product.wxs
|
148
|
|
Error
|
|
ICE30: The target
file 'MICRO~12.DLL|Microsoft.Crm.Sdk.Proxy.dll' is installed in
'[TARGETDIR]\Visual Studio\' by two different components on an LFN system:
'C__646D85FDD00C4F6CBCE0E424030A8F09' and
'C__D325117EC0E8F14DB8B5285A80115139'. This breaks component reference
counting.
|
DeveloperToolkitSetupProject
|
Product.wxs
|
76
|
|
The simple solution is to delete
line 147 through to line 149. What is happening here is that the same file is
being copied to the same location twice by the installer, for some reason. This
may have been some sort of issue that the original Visual Studio Setup Project
had that was not resolved and has carried through to the WiX Setup Project.
After deleting line 147 through to
line 149, compile the Visual Studio Solution again.
You will get another error:
Severity
|
Code
|
Description
|
Project
|
File
|
Line
|
Suppression
State
|
Error
|
|
Unresolved
reference to symbol 'Component:C__D325117EC0E8F14DB8B5285A80115139' in
section 'Product:{BACDFCA3-6A16-4195-AC18-2BE34E154329}'.
|
DeveloperToolkitSetupProject
|
Product.wxs
|
331
|
|
This is because we have deleted
the file at lines 147 through to 149 and the installer cannot find the
reference to the file that is being added as a component here at line 331.
To fix the issue, delete line 331.
If you now compile the Visual
Studio Solution, it should now compile without errors. You are welcome to fix
the warnings, but these would not really make a difference to functionality.
Install the New Developer Toolkit
Open the <YourPreferredTargetPath>\DeveloperToolkitSetupProject\DeveloperToolkitSetupProject/bin/Debug
folder (or the Release folder or other configuration folder, depending on which
configuration you used).
You should see two files:
·
DeveloperToolkitSetupProject.msi
·
DeveloperToolkitSetupProject.wixpdb
The DeveloperToolkitSetupProject.wixpdb
file can be used for debugging the WiX Installer Project. We will ignore this
file completely.
Execute the DeveloperToolkitSetupProject.msi
file.
Now you can test the Developer Toolkit and hope that it
works correctly.