减少工作流程装配尺寸

时间:2014-02-12 07:42:31

标签: dynamics-crm-2011 dynamics-crm dynamics-crm-2013

如何减少工作流程装配的大小(MB)?

具有4个自定义工作流活动的程序集是2.5 MB,其中crmcsvutil.exe是从CRM生成的类;当生成的类未包含在项目中时,相同的程序集为18 KB!

插件注册经常在超时后失败,所以我真的想减小组件的大小。

我尝试将生成的类放在单独的程序集中并引用它,并将程序集放在GAC中,但是会出错。

这是当程序集在沙箱中注册时(我更喜欢):

Assembly 'Tinkerbell.Workflows, Version=2.0.3.4, Culture=neutral, PublicKeyToken=692195edcbe6b163' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself.  In order to access security critical code, this assembly must be fully trusted.'

这是在沙箱外部注册程序集的时候:

'Object of type 'Microsoft.Xrm.Sdk.Entity' cannot be converted to type 'BusinessUnit'.'

这里有什么选择?
我不愿意放弃早期的课程。

2 个答案:

答案 0 :(得分:2)

您只能使用此实用程序Filtering generated entities with CrmSvcUtil生成所需的早期绑定实体。

您只需要指定包含所需实体的xml:

<filter>
  <entities>
    <entity>systemuser</entity>
    <entity>team</entity>
    <entity>role</entity>
    <entity>businessunit</entity>
  </entities>
</filter> 

答案 1 :(得分:1)

您可以手动编辑CRM生成的类文件,以除去您需要的所有实体,但这会有点痛苦,如果您重新生成CRM类文件,则需要重做。

你有没有理由不想放弃早期课程?后期确实有一些优势,并且稍微快一些。如果你想保持早期的约束感,那么你可以编写自己的类,然后编写从类转换为实体的映射函数。