Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WF 4 error with language specific resource dlls

I'm working on a rehosted workflow designer using WF 4, my application which uses this designer control is a multi-language application that loads 2 or more language specific resource dlls. if I have two satellite assemblies for one language such as "en" and "en-US", designer throws an exception like this:

Compiler error(s) encountered processing expression "testExpression". The project already has a reference to assembly MyProject.resources. A second reference to 'C:\Dlls\en-US\MyProject.resources.dll' cannot be added.

and here is the stack trace:

   at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](LocationReferenceEnvironment environment, Boolean isLocationReference)
   at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](LocationReferenceEnvironment environment)

It's worthy to mention that when I took a look at my satellite assemblies' properties, Details tab, I realized that they are all Neutral Language. I think they must be Specific Language so the application can recognize that these dlls are not the same.

What can I do to overcome this problem, can I change the Language property of dll files to become Language Specific? Can this help?

like image 900
VahiD Avatar asked Oct 21 '22 09:10

VahiD


1 Answers

I had this same problem, and I could fix it by defining what dlls the designer can "see" through its AssemblyContextControlItem, filtering out satellite assemblies (which I didn't need anyway):

var acci = this.Designer.Context.Items.GetValue<AssemblyContextControlItem>() ?? new AssemblyContextControlItem();
acci.ReferencedAssemblyNames = acci.AllAssemblyNamesInContext
                                   .Select(an => new System.Reflection.AssemblyName(an))
                                   .Where(an => !an.Name.Contains(".resources"))
                                   .ToList();
this.Designer.Context.Items.SetValue(acci);
like image 165
Igor Soengas Avatar answered Nov 24 '22 07:11

Igor Soengas