Friday, September 09, 2011

Switching CRM Developer Toolkit's Target Environment

It's often the case in our CRM development life that we have the need to change the target development environment from one server to another. Working with the CRM 2011 Developer Toolkit, we can appreciate the productivity that we have gained from the toolkit. However, there wasn't any documentation about how to easily switch target environment using the toolkit.

Here are some little tips that I learned from CRM Development Forum today, that can be used to do so without too much hassles. You can use either one of the following to achieve this.
  1. In Visual Studio's Tools menu, there is a menu item called "Connect to Dynamics CRM Server…". You can simply click it in order to launch CRM connection window where you can enter new connection information to be used to connect to a different server or a different CRM organization.
    image
  2. Delete .suo file from the same folder where your Visual Studio solution file (.sln) resides. After you have done so, the next time you fire up Visual Studio and open the CRM solution again, you will be prompted to enter CRM connection information. What this implies is, the CRM connection settings (including the login credentials) are stored in the .suo file. 
Before knowing the above tricks, I actually raised this as an issue at Microsoft Connect site. To be very honest with you, I tried a number of wild ways to find out how the CRM connection settings are stored and how they can be changed, I did Windows registry search, and I looked into Windows file system for any suspicious activities, nothing led me to a concrete solution. I even came up an idea to stop IIS service in order to fail the connection that Visual Studio is attempting to make, so that it will prompt you to enter new connection settings after the connection fails. I have never thought of .suo file, neither have I ever looked for such options in the Tools menu of Visual Studio!

Knowing the fact that your CRM login credentials are stored in the .suo file, you should be careful when you want to share the file with others. It should also be noted, many developers tend to check-in all files under the Visual Studio solution folder to source control system, including the .suo file. Those of them should be warned or cautioned. Sending .suo file to others and storing it in source control repository should be avoided for security reason.

The tips came from Phil Hand, credit goes to him.

Hope this helps.