I keep getting an error when trying to use Prism4 Bootstrapper with Unity referenced by source (include existing projects into the solution). I also get an error building Unity from source and then including the output files.
Here's the details:
I've got a project using Prism4. The Bootstrapper component for Prism relies on Unity 2.0. To me more precise they rely on Version 2.0.414.0 of unity.
If I try to include the current or a newer version of Prism into My project as prism 4, then VS gives me a message to generate some app.config code that forces the loading of the newest assembly.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<ass开发者_StackOverflowemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.1.505.0" newVersion="2.1.505.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
When using the prebuilt dll files for Unity 2.0 and Unity 2.1, this works without a problem...
However, if I try to build these from source and use the new DLLs, or include the projects directly into my project I always get the error:
The type 'Microsoft.Practices.Unity.IUnityContainer' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Mind you that Unity 2.0 [b]IS[/b] version 2.0.414.0. So my very first attempt was by using the unity 2.0 source base. I have also made many subsequent attempts using this version, including starting from a fresh project. I've tried including Prism by pre-built bin files, source, and custom built dlls with the same result. I've also tried all of the same things using Unity 2.1 in hopes it might work.
My environment is MSVC# 2010 win7 x64. I've built under x86 and Any CPU configurations as well as both debug and release. The only dependencies are Prism and Unity.
Found a workaround.
I opened the solution for the Prism source and removed any references to unity. Then I added the unity project as an existing project to the prism solution. Lastly I referenced the unity as a project for all concerned prism projects. So the unity dll that I'm going to use for my project is being output by the prism unityextensions.
Some batch file updates later and voila, a workaround.
Not the best solution but I'm ready to move on now.
P.S. The subject line is incorrect. This is an issue with UnityExtensions in prism, not modularity. Also I wasn't clear about the UnityBootstrapper when I called it "
精彩评论