Pregunta

Here is the scenario, discovered while trying to troubleshoot the same issue in the self hosted designer. Create a library project with a type in it. Mine is this.

namespace RaceEventLibrary
{
    public class Registration
    {
        public string Name { get; set; }
        public int Age { get; set; }
        public string EventName { get; set; }
    }
}

Now create a Workflow 4.5 console app (or service, it doesn't seem to matter). Reference the library project. Put a sequence on the designer and then make an InArgument of this library type, Registration in my case. All is fine, the designer is happy.

Next create another identical project, reference the same library. Now simply open the xaml file from the first project. Boom, it can't find the types.

System.Xaml.XamlException: 'The type ‘InArgument(r:Registration)’ of property ‘registration’ could not be resolved.'

This in the xaml is:

    <x:Members>
        <x:Property Name="registration" Type="InArgument(r:Registration)" />
    </x:Members>

preceded by 
    xmlns:r="clr-namespace:RaceEventLibrary;assembly=RaceEventLibrary"

With the self hosted designer I have been finding many variations of this issue and have tried various ways to get the library assembly loaded into the designer, but no joy.

Any suggestions of how to correct this?

¿Fue útil?

Solución

WF4 has it own ways of loading assemblies that is not always exactly the same as the standard .NET framework. Ron Jacobs did an interesting number of posts on that, see here for a start.

You don't mention how you actually load the workflow into the WorkflowDesigner. There are several ways of doing this. When using the ActivityXamlServices.CreateBuilderReader() you can specify using the XamlSchemaContext what assemblies are required. That should let you load the workflow.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top