Search

Antony Ellis Dynamics 365 CRM

The blog where Microsoft Dynamics 365 knowledge is shared and development made easier

Category

CRM Developer Toolkit

How to get the missing connect to Dynamics CRM connection back

If you are a Dynamics CRM developer using the Visual Studio CRM Developer toolkit you may have come across this issue where sometimes the “Connect to Dynamics CRM” option disappears. This is quite problematic as without it there is no way to browse the CRM explorer pane and make changes using the interface.

Normally you would see the following option under Tools:

tools.png

 

If that disappears then you have a problem! Perhaps it is just me that has been unlucky but this has happened to me a few times across different CRM solution projects. It  has happened across the following scenarios:

  1.  You create a new CRM Package/Solution but when prompted fail to provide CRM credentials. You then save the solution without a CRM connection. The next time you open that solution there will be on option to connect under tools.
  2. If you change the CRM connection and the values you provide are not valid. You then save the Solution, re-open and the option disappears.
  3. You open a solution that was created in an earlier version of Visual Studio, make changes and then save the solution.

The only way I have found to recover from these scenario’s is to manually edit the Solution file outside of Visual Studio. Normally, when you right click on a project within Visual Studio you can select to “unload the project” doing so allows you to manually edit the project.cs file directly which you have to do sometimes to correct issues with .NET framework versions or perhaps to add specific directives to handle different types/targets for compilation.

However, for solution files, you don’t get that option, so just a case of opening it up in Notepad. I would ensure the solution is closed within Visual Studio just to be extra safe and not encounter access violations.

Once you are in the solution file,

Scroll to the very bottom and add the following:

GlobalSection(CRMSolutionProperties) = preSolution

SolutionIsBoundToCRM = True

EndGlobalSection

Save the file.

The next time you open up Visual Studio you should see that the menu option has been restored and you can connect to CRM again.

I know you are thinking Sweet.

Credits

network – switch   (under license Freeimages.com)

 

How to get CRM Developer Toolkit working with Visual Studio 2013

Guessing you are here because you want to know how to get CRM Developer Toolkit working with Visual Studio 2013 and possibly 2015? The good news is that by following these instructions it will also work with Visual Studio 2015, 2013 and 2012. I have successfully managed to also have all three versions of Visual Studio working on the same development machine with the CRM developer toolkit extension working across each of them. The reason we are in this pickle in the first place, is that Microsoft had no plans to release updated extensions past CRM SDK 2013/VS2012. However rumors are circulating that Microsoft plan to release an updated CRM developer toolkit at some point in 2016 saving us all much hassle!

In the meantime:

Prerequisites

1. Install Visual Studio 2012, then 2013 and 2015+ (assuming you need more than one version running on your development machine!)

2. Ensure all relevant .NET frameworks installed  and. the .NET 4.5.2 developer pack Visual Studio installs mostly take care of this with exception to developer pack which you can download from the Project window

3. Enable Windows Identity Foundation (on Win2012 Server do this in powershell > Add-WindowsFeature windows-identity-foundation)

4. Ensure each version of Visual Studio has installed and opens without error

5. Download CRM2013 SDK and within the Tools folder the Developer Toolkit should be present.

Configure CRM Toolkit Extension

Firstly, I don’t know if there is a way to get the toolkit to install all from one VSIX file? If you do let me know? Struggled with this as it seems that the installer will only accept two versions of visual studio as opposed to three. To get around it I customised the VSIX to work with Visual Studio versions 2012 and 2013. After that, created a separate VSIX file specifically for 2015. When Visual Studio 2016 is released I imagine the process will be much the same just ensuring the right versions are specified (See point 8 below).

1. Create a folder to hold files that we are about to extract from CRM toolkit (e.g. C:\CRMToolkitExtract)

2. Open CMD and navigate to C:\DeveloperToolkit (where I have the default MSI files for CRM2013 version of toolkit)

3. In command prompt run

msiexec /a C:\DeveloperToolkit\CrmDeveloperToolsVS12_Installer.msi /qb TARGETDIR=C:\CRMToolkitExtract

4. In windows explorer Open the Visual Studio folder

5. Rename Microsoft.CrmDeveloperTools.vsix to zip then browse (or you edit directly if using a tool like 7-Zip on your machine)

6. Then we need to edit the extension.vsixmanifest (within zip file)

7. Replace InstalledByMsi=”true” with InstalledByMsi=”false”

8. Replace Version=”[11.0,12.0)” with “[11.0,12.0]” – this being VS2012 and VS2013

or

8. Replace Version=”[11.0,12.0)” with “[12.0,14.0]” – this being VS2013 and VS2015

9. Save extension.vsixmanifest somewhere then copy back into zip archive and overwrite

10. Rename Microsoft.CrmDeveloperTools.zip back to Microsoft.CrmDeveloperTools.vsix or in my case I had two of these:

Microsoft.CrmDeveloperToolsVS2012and2013.vsix

Microsoft.CrmDeveloperToolsVS2013and2015.vsix

Each of the above had the extension.vsixmanifest file configured as required. You can pick as part of the installation of the VSIX whether to update a specific version of Visual Studio or all of them

11. Now create a text file and place these registry values in it:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS\BuildNumber]
“1033”=”12.0″
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS\Pro]
“ProductDir”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\”
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS\VSTD]
“ProductDir”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\”

This worked fine for me with Visual Studio 2012 and 2013 however unsure if the issue was related or not but had issues with 2015. I ran the following registry update which is similar to above but has more environmental settings then everything worked across all product versions:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS]
“ProductDir”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\”
“MSMDir”=”C:\\Program Files (x86)\\Common Files\\Merge Modules\\”
“VS7EnvironmentLocation”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\devenv.exe”
“EnvironmentPath”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\devenv.exe”
“EnvironmentDirectory”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\”
“VS7CommonDir”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\”
“VS7CommonBinDir”=””
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS\BuildNumber]
“1033”=”12.0″
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS\Pro]
“ProductDir”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\”
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Setup\VS\VSTD]
“ProductDir”=”C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\”

12. Save the file as VSToolkit.reg

13. Double click the VSToolkit.reg file to open and update registry settings

14. Now run Microsoft.CrmDeveloperTools.vsix from within the extracted folder (i.e. the file modified above) to install toolkit

15. The following is crucial for the developer toolkit to place nice within Visual Studio..

Navigate to the root folder C:\CRMToolkitExtract and you will see a folder called CRM MSBuild, copy this folder into program files *C:\Program Files (x86)\MSBuild\Microsoft\* and rename folder CRM MSBUILD to CRM

It is very important that you do this after running VSIX or any other Visual Studio installation/upgrade as sometimes the folder is deleted which will cause different but similar errors across each version of VS installed.

16. Start Visual Studio, you should now see a Dynamics CRM project file option under projects. This should be the case across all VS installs you have on the machine.

17. Verify you can connect to CRM without errors (as it is only at this point that VS attempts to read the template files and create the CRM solution). I tested this and it worked with versions of Dynamics CRM 2011, 2013, 2015 and 2016.

Conclusion

It was not the simplest of tasks to get this working across the latest versions of Visual Studio but had a (little!) help from the following:

Hosks

https://crmbusiness.wordpress.com/2015/06/05/getting-the-crm-developer-toolkit-working-with-visual-studio-2013/

CRM Community

https://community.dynamics.com/crm/b/tsgrdcrmblog/archive/2014/08/23/microsoft-dynamics-crm-2013-toolkit-with-visual-studio-2013

There are other possible alternatives to the Microsoft CRM Developer Toolkit, none of which I have yet played with but if you have any thoughts on these tools or experience using them please post below and share knowledge.

https://visualstudiogallery.msdn.microsoft.com/0f9ab063-acec-4c55-bd6c-5eb7c6cffec4

https://crmbusiness.wordpress.com/2015/06/10/crm-developer-toolkit-alternatives/

Powered by WordPress.com.

Up ↑