Missing CRM Explorer in Visual Studio 2012

Some people have reported that opening a CRM project in Visual Studio 2012 that has not been connected to a CRM organisation causes the CRM Explorer window not to load when the project is loaded as well as there being no option to show it from the VIEW menu and no option to Connect To Dynamics CRM Server in the TOOLS menu. There seem to be several causes of this behavior, the most common of which being the failure to set the CRM organisation when creating the project.

The problem seems to be that there is a missing section in the visual studio solution file. To fix the issue, follow the process below:

  1. Close the Visual Studio project
  2. Open the Visual Studio Solution file in a text editor such as notepad.
  3. Find the Global section and insert the highlighted section below at the beginning of the section

    Global
        GlobalSection(CRMSolutionProperties) = preSolution
            SolutionIsBoundToCRM = True
        EndGlobalSection
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
            Debug|Any CPU = Debug|Any CPU
            Debug|Mixed Platforms = Debug|Mixed Platforms
            Debug|x86 = Debug|x86
            Release|Any CPU = Release|Any CPU
            Release|Mixed Platforms = Release|Mixed Platforms
            Release|x86 = Release|x86
        EndGlobalSection
    EndGlobal
        
  4. Save the file.
  5. Open the Visual Studio project.
  6. If all has gone to plan, the Connect To Dynamics CRM Server dialog will now pop up and ask you to connect to your CRM Organisation.
Advertisements

CRM 2011 Developer Tools target location for Visual Studio 2010 vs Visual Studio 2012

The path for the targets is different for the Developer Toolkit for Visual Studio 2010 and Visual Studio 2012. This can cause errors when loading the Visual Studio project in the form of the error

The imported project “C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

or when attempting to deploy the CrmPackage project from Visual Studio 2010 as the error

Error connecting to CRM Server. [A]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution cannot be cast to [B]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution. Type A originates from ‘Microsoft.CrmDeveloperTools.CrmClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Dynamics CRM 2011 Developer Tools\1.0\Microsoft.CrmDeveloperTools.CrmClient.dll’. Type B originates from ‘Microsoft.CrmDeveloperTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.dll’.

or when attempting to deploy the CrmPackage project from Visual Studio 2012 as the error

Error connecting to CRM Server. [A]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution cannot be cast to [B]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution. Type A originates from ‘Microsoft.CrmDeveloperTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Dynamics CRM 2011 Developer Tools\1.0\Microsoft.CrmDeveloperTools.dll’. Type B originates from ‘Microsoft.CrmDeveloperTools.CrmClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.CrmClient.dll’.

depending on the combination of Visual Studio version, installed Developer Toolkit version and previously installed Developer Toolkit versions.

In order to resolve any of these, make sure that the correct targets are referenced in the CrmPackage.csproj file:

  1. In Visual Studio, right click the CrmPackage project and click Unload Project.
  2. Right click on the CrmPackage project and click edit CrmPackage.csproj.
  3. Find the line starting with “<Import Project="$(MSBuildExtensionsPath32)\Microsoft\CRM\" and replace it with the correct path from the list below.
  4. Save and close the file.
  5. Right click on the CrmPackage project and click Reload Project.
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\CRM\Microsoft.CrmDeveloperTools.12.targets" />