web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Error in CRM Online when using ILMerge: Operation could destabilize the system

(1) ShareShare
ReportReport
Posted on by

Hi,

I'm trying to merge my Custom Workflow dlls using ILMerge. I followed the step to set CopyLocal to false for Microsoft.Xrm.Sdk, Microsoft.Crm.Sdk.Proxy,Microsoft.Sdk.Workflow and Microsoft.IdentityModel.

When I executed my workflow in CRM, I got the error: 

Unexpected exception from plug-in (Execute): MyWorkflow.MyWorkflow: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

So I added back the Microsoft.Xrm.Sdk dll (CopyLocal to true), and updated my workflow. 

This time I got the exception: 

Unexpected exception from plug-in (Execute):  MyWorkflow.MyWorkflow: System.Security.VerificationException: Operation could destabilize the runtime.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi SB,

    You're fine having the assembly included, the error is coming out of something in your code. Check out this post for more details: stackoverflow.com/.../operation-could-destabilize-the-runtime

    Hope this helps! I'd appreciate if you'd mark this as Answering your questoin.

    Thanks,

     Aiden

  • Community Member Profile Picture
    on at

    Hi Aiden,

    I think I'm doing something wrong in using ILMerge with my Custom Workflow. I uninstalled ILMerge and ran my application, it worked fine.

    I reinstalled "MsBuild ILMerge Task" and set all the assemblies below CopyLocal to true:

    Microsoft.Xrm.Sdk

    Microsoft.Crm.Sdk.Proxy

    Microsoft.Sdk.Workflow

    Microsoft.IdentityModel

    When trying to update my workflow in the plugin registration tool, I get several dlls appearing under my project that are related to "Microsoft.Sdk.Workflow" as shown in the screenshot below:

    4375.Capture.JPG

    Whether I include them or exclude them when updating my assembly I get an error in plugin registration tool:

    Preparing Registration
    ERROR: Occurred while checking whether the assembly exists

    When I set the Microsoft.Sdk.Workflow CopyLocal to false and execute my workflow, I get the error "Operation could destabilize the runtime"

  • Verified answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi SB,

    My mistake. I use IL Merge GUI to merge assemblies and just opened up a config file I use and you don't have to include the Microsoft assemblies. I really have no idea why you'd be getting that error from the plugins unless you're running 2015 and calling the 2016 SDK.

    Thanks,

     Aiden

  • Community Member Profile Picture
    on at

    I reset these 4 assemblies CopyLocal to false and the plugin executed correctly.

    Microsoft.Xrm.Sdk

    Microsoft.Crm.Sdk.Proxy

    Microsoft.Sdk.Workflow

    Microsoft.IdentityModel

    I appreciate your help Aiden

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans