Я следую руководству по how to build a console application that connects to Dynamics CRM, но застрял в самом начале с использованием CrmSvcUtil. вот что я сделал:CrmSvcUtil: определение манифеста расположенной сборки не соответствует ссылке на сборку
скопировали эту команду:
CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /out:Xrm.cs /url:https://<mydomain>.api.crm.dynamics.com/XRMServices/2011/Organization.svc /username:<myusername>@<mydomain>.onmicrosoft.com /password:<mypassword> /namespace:Xrm /serviceContextName:XrmServiceContext
заменил выше
/url
с тем, который указан в моем CRM онлайн развертывания в разделе Настройки> Адаптации> Ресурсы для разработчиков> Организация службы.заменил вышеуказанное
/username
на мое имя пользователя onmicrosoft.com и поместил кавычки до и после него.заменен вышеуказанным
/password
способом, который я сделал с/username
.- последовал эту записку и положил
Xrm.Client.CodeGeneration.dll
на ту же директорию с CrmSvcUtil.exe .:
Note that the Microsoft.Xrm.Client.CodeGeneration.dll file must be in the same directory as the CrmSvcUtil.exe file
, а потом я побежал, и получил следующее сообщение об ошибке:
CrmSvcUtil : CRM Service Utility [Version 8.1.0.7711]
c 2015 Microsoft Corporation. All rights reserved
Exiting program with exception: Could not load file or assembly 'CrmSvcUtil, Version=7.0.0.0, Cult
ure=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest
definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
CrmSvcUtil Error: 2 : Exiting program with exit code 2 due to exception : System.IO.FileLoadExcept
ion: Could not load file or assembly 'CrmSvcUtil, Version=7.0.0.0, Culture=neutral, PublicKeyToken
=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'CrmSvcUtil, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase
, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadType
FromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase
, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromP
artialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolea
n reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at Microsoft.Crm.Services.Utility.ServiceFactory.CreateInstance[TIService](TIService defaultSer
viceInstance, String parameterValue, CrmSvcUtilParameters parameters)
at Microsoft.Crm.Services.Utility.ServiceProvider.InitializeServices(CrmSvcUtilParameters param
eters)
at Microsoft.Crm.Services.Utility.CrmSvcUtil.get_ServiceProvider()
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!En
ableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
CrmSvcUtil Error: 2 : ===== DETAIL ======
CrmSvcUtil Error: 2 : Source : mscorlib
Method : GetTypeByName
Date : 15:52:37
Time : 28/10/2016
Error : Could not load file or assembly 'CrmSvcUtil, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
or one of its dependencies. The located assembly's manifest definition does
not match the assembly reference. (Exception from HRESULT: 0x80131040)
Stack Trace : at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean
ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder,
Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase,
Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at Microsoft.Crm.Services.Utility.ServiceFactory.CreateInstance[TIService](TIService defaultServiceInstance, String parameterValue, CrmSvcUtilParameters parameters)
at Microsoft.Crm.Services.Utility.ServiceProvider.InitializeServices(CrmSvcUtilParameters parameters)
at Microsoft.Crm.Services.Utility.CrmSvcUtil.get_ServiceProvider()
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
Что такое способ его решения?
EDIT: Я попытался с помощью Early Bound Generator - просто загрузив его, соединяясь, и нажать кнопку «Создать Сущности», но заканчивается с ошибкой:
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at DLaB.CrmSvcUtilExtensions.Entity.CodeWriterFilterService.GenerateOptionSet(OptionSetMetadataBase optionSetMetadata, IServiceProvider services)
at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildAttributeOptionSet(EntityMetadata entity, AttributeMetadata attribute, CodeTypeMember attributeMember, ServiceProvider serviceProvider)
at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildEntity(EntityMetadata entity, ServiceProvider serviceProvider)
at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildEntities(EntityMetadata[] entityMetadata, ServiceProvider serviceProvider)
at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildCodeDom(IOrganizationMetadata organizationMetadata, String outputNamespace, ServiceProvider serviceProvider)
at Microsoft.Crm.Services.Utility.CodeGenerationService.Microsoft.Crm.Services.Utility.ICodeGenerationService.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String outputNamespace, IServiceProvider services)
at DLaB.CrmSvcUtilExtensions.BaseCustomCodeGenerationService.WriteInternal(IOrganizationMetadata organizationMetadata, String language, String outputFile, String targetNamespace, IServiceProvider services)
at DLaB.CrmSvcUtilExtensions.BaseCustomCodeGenerationService.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String targetNamespace, IServiceProvider services)
Output file was not updated or not found!
Работал, спасибо! – HeyJude