using System; using System.Configuration; using System.Linq; using System.Net; using System.ServiceModel.Description; using CrmDynamics; using Microsoft.Xrm.Sdk.Client; namespace ConsoleApplication12 { class Program { private static readonly string TargetCrmService = ConfigurationManager.AppSettings["TargetCrmService"]; private static readonly string UserName = ConfigurationManager.AppSettings["UserName"]; private static readonly string Domain = ConfigurationManager.AppSettings["Domain"]; private static readonly string Password = ConfigurationManager.AppSettings["Password"]; public static ClientCredentials ClientCredentials { get { var credentials = new ClientCredentials(); credentials.Windows.ClientCredential = new NetworkCredential(UserName, Password, Domain); return credentials; } } static void Main(string[] args) { var serviceProxy = new OrganizationServiceProxy(new Uri(TargetCrmService), null, ClientCredentials, null); serviceProxy.EnableProxyTypes(); var context = new CrmServiceContext(serviceProxy); var workflows = context.AsyncOperationSet.Where(x => x.Name.Contains("Hooman")); foreach (var workflow in workflows) { Console.WriteLine(workflow.Name); } Console.ReadLine(); } } }By running the above code and making sure that I have referenced all required DLL files still i had this error:
The type or namespace name 'Xrm' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
How To Solve It?
Simply change your project to run in .NET Framework 4.0!
Right click on your project and click on properties and change your target framework to >NET Framework 4
Thanks
ReplyDeleteThanks
ReplyDeleteThanks, Small thing but wasting lots of him :)
ReplyDelete