Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

Plugin assembly not reloaded after update - IIS restart needed

Posted on by 10

Dear community,

we use a custom tool written in C# and using the Dynamics SDK to deploy plugin assembly binaries to our Dynamics dev environment (on-premise, IsolationMode "None", SourceType "Database").

The tool simply updates the PluginAssembly entity, like:

var context = new ServiceContext(service);
var pluginAssembly = context.PluginAssemblySet.Single(pa => pa.Name == "testpluginassembly");
var upd = new PluginAssembly()
{
	Id = pluginAssembly.Id,
	Content = Convert.ToBase64String(File.ReadAllBytes("testpluginassembly.dll")),
	Description = "test plugin assembly"
};

service.Update(upd);

Note: The plugin assembly is alread present in the dev environment, as well as registered plugins, sdk message processing steps and images.

This technique used to work fine in previous Dynamics versions: After updating the PluginAssembly, the Dynamics server recognized the change and automatically reloaded the plugin assembly in IIS. The changes were effective immediately.

However, in 9.1.0007.0005 version of Dynamics 365 we need to manually restart IIS (or recycle the CRMAppPool) in order to force the Dynamics server to actually reload the plugin assembly. Otherwise the old version of the plugin assembly remains active for minutes to hours and even days.

We tried to increase the plugin assembly version number, however without any effect.

Do you know how to fix this?

Thanks and best regards,

Johannes.

  • Suggested answer
    Johannes R Profile Picture
    Johannes R 10 on at
    RE: Plugin assembly not reloaded after update - IIS restart needed

    Hi,

    We found a workaround. 

    After updating the plugin assembly binaries (see above), we programmatically disable and enable a single (pseudo) SdkMessageProcessingStep. This triggers the reload of the plugin assembly by Dynamics 365.

    var context = new ServiceContext(service);
    var step = context.SdkMessageProcessingStepSet.Single(s => s.Name == PSEUDO_STEP_NAME);
    
    service.Execute(new SetStateRequest()
    {
      EntityMoniker = step.ToEntityReference(),
      State = new OptionSetValue((int)SdkMessageProcessingStepState.Disabled),
      Status = new OptionSetValue((int)sdkmessageprocessingstep_statuscode.Disabled)
    });
    
    service.Execute(new SetStateRequest()
    {
      EntityMoniker = step.ToEntityReference(),
      State = new OptionSetValue((int)SdkMessageProcessingStepState.Enabled),
      Status = new OptionSetValue((int)sdkmessageprocessingstep_statuscode.Enabled)
    });

    Best regards,

    Johannes.

  • Johannes R Profile Picture
    Johannes R 10 on at
    RE: Plugin assembly not reloaded after update - IIS restart needed

    Hi,

    thanks for your reply.

    Publishing all customizations does not solve the problem.

    Regards,

    Johannes.

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,962 Moderator on at
    RE: Plugin assembly not reloaded after update - IIS restart needed

    Hi,

    You will need to publish customization programmatic after updating the assembly from c#.

    www.inogic.com/.../

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans