2014-12-04 83 views
0

我開發了一個用於本地crm 2013的插件(PreCreateOpportunityProduct - 沒有特別之處)。在我的visual studio crm解決方案中,我添加了一個項目(稱爲BusinessLogic),其中包含我生成的Entities.cs以及每個實體的部分類。因此,我可以將一個特殊實體的邏輯封裝在一個單獨的類中。目前沒有什麼大不了的。 現在我想要使用這些邏輯,因此我在我的插件項目中添加了項目引用。我知道我需要將所有需要的DLL合併到一個,所以我添加了一個後生成事件來合併所有的DLL和ILMerge。與使用的DLL解決方案/項目的使用ILMerge在MS CRM 2013中插件失敗

概述:

solution overview

構建後命令如下所示:

mkdir "$(TargetDir)Merged" 
"$(SolutionDir)Libs/ilmerge.exe" /keyfile:"$(ProjectDir)keypair.snk" /target:library /copyattrs /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /out:"$(TargetDir)Merged\Flag.Plugins.dll" "$(TargetDir)Flag.Plugins.dll" "$(TargetDir)BusinessLogic.dll" "$(TargetDir)Microsoft.Crm.Sdk.Proxy.dll" "$(TargetDir)Microsoft.Xrm.Sdk.dll" 
del "$(TargetDir)*.*" /Q 
move "$(TargetDir)Merged\*.*" "$(TargetDir)" 

的RegisterFile.crmregister:

<?xml version="1.0" encoding="utf-8"?> 
<Register xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/crm/2011/tools/pluginregistration"> 
    <Solutions> 
    <Solution Assembly="Flag.Plugins.dll" Id="f4dff197-5b7a-e411-80c3-005056ba5a51" IsolationMode="None" SourceType="Database"> 
     <PluginTypes> 
     <Plugin Description="Plug-in to PreOpportunityProductCreate" FriendlyName="PreOpportunityProductCreate" Name="Flag.Plugins.PreOpportunityProductCreate" Id="0f7bd0bc-2b7b-e411-80c3-005056ba5a51" TypeName="Flag.Plugins.PreOpportunityProductCreate"> 
      <Steps> 
      <clear /> 
      <Step CustomConfiguration="" Name="PreOpportunityProductCreate" Description="Pre-Operation of Opportunity Product Create" Id="107bd0bc-2b7b-e411-80c3-005056ba5a51" MessageName="Create" Mode="Synchronous" PrimaryEntityName="opportunityproduct" Rank="1" SecureConfiguration="" Stage="PreInsideTransaction" SupportedDeployment="ServerOnly"> 
       <Images /> 
      </Step> 
      </Steps> 
     </Plugin> 
     </PluginTypes> 
    </Solution> 
    </Solutions> 
    <XamlWorkflows /> 
</Register> 

注意:我是Deployment Manager +系統管理員 - >所有權限

當我點擊CrmPackage項目,誤差部署

Error registering plugins and/or workflows. Plug-in assembly does not contain the required types or assembly content cannot be updated. C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets 

注2:當我部署不合並所有其他DLL部署就像魅力plugin.dll,但該插件拋由於BusinessLogic.dll未知,所以發生異常。

任何人都可以幫助我解決這個問題嗎?

在此先感謝

回答

2

我發現問題:我合併了太多的文件!詳細說明:這是Microsoft.Crm.Sdk.Proxy.dll和Microsoft.Xrm.Sdk.dll。這些庫已經在crm服務器GAC中。從我的ilmerge命令中刪除這些文件後,部署終於可以正常工作。

這裏是給我提示重要提示的鏈接: https://community.dynamics.com/crm/f/117/p/146347/326928.aspx#326928

相關問題