How to load workflow assembly from a specific directory?
P.S. I posted this question at the beta newsgroup but did not get a response, so I thought I would try it here since this forum has been pretty helpful in the past.
P.S. I posted this question at the beta newsgroup but did not get a response, so I thought I would try it here since this forum has been pretty helpful in the past.
There most certainly is a way to do this. You need to add dynamic type/assembly resolution in order to achieve this.
AppDomain You can store your dynamically generated workflow assemblies in a collection and when the .NET runtime attempts to search for them and fails to find them, it will call your handlers to provide the required assembly/type. See http://msdn.microsoft.com for examples and details on these .NET APIs. Thanks!
AppDomain.CurrentDomain.AssemblyResolve += asmHandler
Angel
The only issue I see (in this scenario) is that if I have two hosting apps, they would not be able to share the same workflows if they (hosting apps) are deployed to different folders. I do not anticipate this to happen, so it should be OK. It would be nice to be able to easily load a workflow from a directory that does not belong to the application folder, though.
This is fine...the above solution will still work given the information you have available (the path to the assemblies). In your assembly resolve handler, you can search the required assembly in the specified folder by name (which is provided in the event args of the handler) on a per need basis (every time your handler is called), load that assembly, and return it.
Of course, you could avoid all of this if the target folder is a child folder of the application directory and specify the "probe private" config entry.
Thanks,
Angel