Use the Sample and Helper Code
Most managed code samples provided in the Microsoft Dynamics CRM SDK that use the organization and discovery web services are using shared helper code to perform common tasks. You might find this helper code useful in applications that you write. Sample helper code can be found in the following folders in the SDK download, and also by following the links provided later in this topic.
SDK\SampleCode\CS\HelperCode
SDK\SampleCode\VB\HelperCode
When writing an application that uses the Microsoft Dynamics CRM SDK, you typically have to perform the following steps to configure your application’s project.
-
In the project’s properties, set the target framework to .NET Framework 4.
-
Add the following .NET references to your project:
System.Data.Linq
System.Runtime.Serialization
System.Security
System.ServiceModel
System.DirectoryServices.AccountManagement -
Add the required Microsoft Dynamics CRM SDK assembly references. At a minimum, add Microsoft.Crm.Sdk.Proxy and Microsoft.Xrm.Sdk. For a complete list of the assemblies included in the Microsoft Dynamics CRM SDK, see Assemblies Included in the Microsoft Dynamics CRM SDK.
-
In most cases, you have to install Windows Identity Foundation and add a reference to Microsoft.IdentityModel to your project. You can find this assembly in the global assembly cache or at the following location:
Program Files\Reference Assemblies\Microsoft\Windows Identity Foundation\v3.5.
For more information about running the samples included in the Microsoft Dynamics CRM SDK download, see the SDK\SampleCode\Readme.docx. To view a sample application that uses the helper code and includes the required .NET references, see the QuickStart link.
A non-customized early-bound types file that is named MyOrganizationCrmSdkTypes is included in the SDK download in the SampleCode\CS\HelperCode and SampleCode\VB\HelperCode folders to help get you started. However, if your organization has custom or customized entities, you should generate a new early-bound types file. For the purposes of this documentation, the generated classes are included in the global namespace. For more information, see Create Early Bound Entity Classes with the Code Generation Tool (CrmSvcUtil.exe).
See Also
Tasks
Helper Code: ServerConnection ClassHelper Code: DeviceIdManager Class
Helper Code: SystemUserProvider Class
Helper Code: Enumerations for Option Sets
Run a Simple Program Using Microsoft Dynamics CRM Web Services
Concepts
Sample Code DirectoryAssemblies Included in the Microsoft Dynamics CRM SDK
Use Microsoft Dynamics CRM Services in Code
Other Resources
Write Applications and Server ExtensionsBlog: How to build and run the Dynamics CRM SDK samples on Windows Server 2012 and Windows 8
Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.