In my previous post, I’ve been exploring how changing the version of an ActivityLibrary affects a workflow.  In this post I want to explore how Workflow Services behave.

The good news – as far as I can tell, they behave exactly as they should behave loading the assembly version they were built with. 

For this test I have a Workflow Service that uses an activity from ActivityLibrary1 and we will run through a similar set of scenarios deploying a Workflow Service (.xamlx) to a web site hosted in IIS.

Scenario 1: Baseline 
Host (IIS) Workflow Service V1, Activity (Bin V1)

Expected: Workflow Service will load Activity V1 from Bin directory

Assembly Version Path
XamlAssemblyResolutionWeb 1.0.0.0 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\8950055e\173b0e0e\assembly\dl3\f71eb821\4409cc42_f2b0cb01\XamlAssemblyResolutionWeb.DLL
ActivityLibrary1 1.0.0.0 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\8950055e\173b0e0e\assembly\dl3\d859493c\625d8742_f2b0cb01\ActivityLibrary1.DLL

Scenario 2: Activity in GAC 
Host (IIS) Workflow Service V1, Activity (GAC V1)

Expected: Workflow Service will load Activity V1 from GAC

Assembly Version Path
XamlAssemblyResolutionWeb 1.0.0.0 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\8950055e\173b0e0e\assembly\dl3\f71eb821\c80c6811_f6b0cb01\XamlAssemblyResolutionWeb.DLL
ActivityLibrary1 1.0.0.0 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\ActivityLibrary1\v4.0_1.0.0.0__c18b97d2d48a43ab\ActivityLibrary1.dll

 

Scenario 3: Upgrade Activity to V2 deploy to bin 
Host (IIS) Workflow Service V1, Activity (Bin V2)

Expected: Workflow Service will fail with exception because it cannot load Activity V1

Actual: System.IO.FileLoadException: Could not load file or assembly 'ActivityLibrary1, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c18b97d2d48a43ab' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Scenario 4: Upgrade Activity to V2 deploy to GAC side by side with V1
Host (IIS) Workflow Service V1, Activity V2, Deploy (Bin V2) (GAC V1, V2)

Expected: Workflow Service will load activity V1 from GAC

Assembly Version Path
XamlAssemblyResolutionWeb 1.0.0.0 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\8950055e\173b0e0e\assembly\dl3\f71eb821\46453429_f8b0cb01\XamlAssemblyResolutionWeb.DLL
ActivityLibrary1 1.0.0.0 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\ActivityLibrary1\v4.0_1.0.0.0__c18b97d2d48a43ab\ActivityLibrary1.dll

 

Scenario 5: Upgrade Activity to V2 deploy to GAC remove V1 from GAC
Host (IIS) Workflow Service V1, Activity (GAC V2)

Expected: Workflow Service will fail with exception because it cannot load Activity V1

Actual: Exception Could not load file or assembly 'ActivityLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c18b97d2d48a43ab' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Scenario 6: Upgrade Workflow Service and Activity but fail to deploy Activity V2
Host (IIS) Workflow Service V2, Activity (GAC V1)

Expected: Workflow Service will fail with exception because it cannot load Activity V2

Actual: System.IO.FileNotFoundException: Could not load file or assembly 'ActivityLibrary1, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c18b97d2d48a43ab' or one of its dependencies. The system cannot find the file specified.

Scenario 7: Upgrade Workflow Service and Activity but fail to deploy Activity V2

Host (IIS) Workflow Service V2, Activity (GAC V1) (Bin V1)

Expected: Workflow Service will fail with exception because it cannot load Activity V2

Actual: System.IO.FileLoadException: Could not load file or assembly 'ActivityLibrary1, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c18b97d2d48a43ab' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Scenario 8: Upgrade Workflow Service and Activity but fail to deploy Activity V2
Host (IIS) Workflow Service V2, Activity (GAC V1) (Bin V1)

Expected: Workflow Service will fail with exception because it cannot load Activity V2

Actual: System.IO.FileLoadException: Could not load file or assembly 'ActivityLibrary1, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c18b97d2d48a43ab' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)