问题
I am using WF4 and am having my types, activities and workflows in the same project and then I am using ActivityXamlServices.Load(path) to load my workflow activity and it throws the following exception:
The type ‘InArgument(local:,,,, of property ‘InputArgs’ could not be resolved
By looking at the solution to this problem at this post, I included assembly name manually in the workflow, and it all works.
Problem: Everytime I make any change in the workflow, it re-writes the xaml and removes the assembly names I manually added.
Question: Is there a way to mandate including assembly names of local types also?
回答1:
The trick is to use a XamlXmlReaderSettings and specify what should be used as the local assembly reference.
var settings = new XamlXmlReaderSettings()
{
LocalAssembly = typeof(YourArgumentType).Assembly
};
var reader = new XamlXmlReader(path, settings);
Activity workflow = ActivityXamlServices.Load(reader);
来源:https://stackoverflow.com/questions/14390131/how-to-mandate-workflows-to-include-local-types-assembly-name