2014-12-04 85 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

相关问题