Question

I am getting this exception in the main Project PrismDashboard:

Source\PrismDashboard\bin\Debug\PrismDashboard.vshost.exe System.Windows.Markup.XamlParseException occurred HResult=-2146233087 Message=Could not load file or assembly 'Microsoft.Expression.Interactions, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

This is the project with Bootrstrapper and Shell. It is happening because Shell is using ModuleA from another Project:

Source\Modules\ModuleA

That requires refrence to Microsoft.Expression.Interactions and I can see that this DLL exists in:

Source\Modules\ModuleA\bin\Debug

I'm not getting compile error, and I'm getting runtime error. ModuleA View will be injected into Shell Region, and this View requires Microsoft.Expression.Interactions which is referenced in ModuleA project but not in the main Project with Bootstrapper and Shell.

I don't want to add reference to DLL's required by other projects in my main project. Have tried to set Embaded Interop Types on reference in ModulaA but getting error:

Error 1 Cannot embed interop types from assembly 'c:\Program Files (x86)\Microsoft SDKs\Expression\Blend.NETFramework\v4.0\Libraries\Microsoft.Expression.Interactions.dll' because it is missing either the 'ImportedFromTypeLibAttribute' attribute or the 'PrimaryInteropAssemblyAttribute' attribute c:\Program Files (x86)\Microsoft SDKs\Expression\Blend.NETFramework\v4.0\Libraries\Microsoft.Expression.Interactions.dll ModuleA Error 2 Cannot embed interop types from assembly 'c:\Program Files (x86)\Microsoft SDKs\Expression\Blend.NETFramework\v4.0\Libraries\Microsoft.Expression.Interactions.dll' because it is missing the 'GuidAttribute' attribute c:\Program Files (x86)\Microsoft SDKs\Expression\Blend.NETFramework\v4.0\Libraries\Microsoft.Expression.Interactions.dll ModuleA

Was it helpful?

Solution

The main application needs to be able to find Microsoft.Expression.Interactions in order to load module A, no way around it. Also keep in mind when you distribite your application the same rule applies.

If you really don't want to reference that assembly in your shell project (which btw is actually the easiest way since it will copy it to the main application's output dir so you're settled) the only other option is copying it there manually. Could be done using a post-build event, but by doing that you're also tieing both projects together since they need to know about each other's output directory. Another way is making all projects put their output in the same directory. I'v been using that for some pretty large scale applications and it works nicely. Also distributing the application is then just a matter of copying that entire directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top