Search code examples
c#-4.0visual-studio-2012dynamics-crmmicrosoft-dynamics

Cannot deploy code to Dynamics CRM instance via Visual Studio


Project Background

My project runs on Dynamics CRM & we have developed many plugins for it with the Visual Studio 2012.


I usually connects to CRM as follows

  1. Open Visual Studio CRM Solution
  2. Navigate to Tools -> Connect to Dynamics CRM Server
  3. Specify CRM Discovery Service Name
  4. select HTTPS
  5. Click Connect
  6. Check Use Default Credentials
  7. Click Log on
  8. Select the Organization (Production or Sandbox instance)
  9. select the solution in the organization

Then when deploying Solutions

  1. Right click the Solution
  2. clean it
  3. build it
  4. deploy it

Problem

But recently it is not possible to connect to the CRM SANDBOX. I'm sure there is no wrong in the process since I have done it many times previously.

it appears as follows

  1. Open Visual Studio CRM Solution
  2. Tools -> Connect to Dynamics CRM
  3. Enter CRM Discovery Service Name
  4. choose HTTPS & Click Connect
  5. Log in using Credentials
  6. SELECT THE ORGANIZATION AS SANDBOX(DEV)

Dialog box gets Closed, but no error. Some time Visual studio gets restarted. So no way to deploy solutions to the sandbox.

Image of Connect to Dynamic Server Dialog box

Things I Tried so far

  • run VS as Administrator
  • Add the Global Section to solution file (.sln) using text editor.
  • Replaced the Microsoft.Xrm.Sdk.dll in CRM Developer Tools add-on
  • Added following lines to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe.config

    <dependentAssembly>
    <assemblyIdentity name="Microsoft.Xrm.Sdk" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
    <bindingRedirect oldVersion="6.0.0.0-6.1.0.0" newVersion="7.0.0.0"/>
    </dependentAssembly>
    
  • Tried to connect by installing 3rd party tools such as CRM Toolkit from Visual studio package manager

Any support is welcome.


Solution

  • I also got the same exact problem before couple of months. And this is the worked Solution for me.

    Solution

    1. Updated the Visual Studio for VS2015 (In my case Microsoft Dynamics 365 SDK didn't support for Visual studio 2013)
    2. Uninstall the current Microsoft Dynamics CRM Toolkit (mine was 2013)
    3. Install the Microsoft Dynamics 365 SDK (https://www.microsoft.com/en-us/download/confirmation.aspx?id=50032)
      • Contains the complete SDK for
        • Microsoft Dynamics 365
        • Microsoft Dynamics CRM Online (related to your instance)
        • Microsoft Dynamics CRM 2016 (on-premises)
    4. Install Microsoft Dynamics 365 Developer Toolkit (https://marketplace.visualstudio.com/items?itemName=DynamicsCRMPG.MicrosoftDynamicsCRMDeveloperToolkit)
      • Go to Tools menu -> click Extension Manager
      • In Extension Manager, in the left pane, click Online Gallery
    5. After a restart your computer, run the project.
      • There can be some errors while loading the project, Since we have update the Visual Studio for a upper version. You might need to migrate your project & resolve error messages.
    6. Try to get connect with CRM instance using CRM Explorer.
      • Interface should be different than previous one, As follows

    NOTE - Please confirm that you have right privileges to connect to the instance as the first step.