2016-10-28 5 views
1

how to build a console application that connects to Dynamics CRMのチュートリアルに従っていますが、始めにCrmSvcUtilを使用して固執しています。 は、ここで私がやったことだ:CrmSvcUtil:配置されたアセンブリのマニフェスト定義がアセンブリ参照と一致しません

  1. 次のコマンドをコピー:

    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 
    
  2. は、[設定]> [カスタマイズ]> [開発者向けリソースの下で私のCRMオンライン展開>組織サービスに記載されているものと上記/urlを置き換えます。

  3. 上記の/usernameを私のonmicrosoft.comのユーザー名で置き換え、前後に引用符を入れてください。

  4. 上記の/passwordの代わりに/usernameとしました。

  5. は、このノートに続き、CrmSvcUtil.exeと同じディレクトリにXrm.Client.CodeGeneration.dllを置く:

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) 

何それを解決する方法は?

編集:私はアーリーバインドジェネレータを使用してみました - ただ、それをダウンロードし、接続、および「エンティティの作成」をクリックすると、それはエラーで終了します。

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! 

答えて

2

あなたが「CRM 2016」としてあなたの質問をタグ付けし、 CRM 2015のSDKに 'Xrm.Client.CodeGeneration.dll'が存在しません。このDLLをCRM 2015 SDKからCRM 2016 SDKのbinディレクトリにコピーするとエラーが発生しますこのDLLは8.0.0ではなく7.0.0のバージョンに依存しているからです。 CRM 2015 SDK(7.1.0)を使用してCSファイルを生成できます。

+0

ありがとう! – HeyJude

関連する問題