I have set up an Unity 2.0.414.0 container using app config.
My solution structure looks like this:Project A: dependency factory using Unity with unity xml config file.
Project B: Several types that are implementations of interfaces used in Unity config. These types reference Microsoft.Sharepoint.dll. Project C: Other implementation types for Unity. No reference to Sharepoint dlls.During the unit test execution in Visual Studio 2010 I have problems.
When I try to load my Unity configuration for any of Project B types it fails to load and causes the whole container to fail it's configuration. After several attempts to solve the problem setting and checking the references of project B I noticed that Unity works fine if all my assemblies are installed in GAC开发者_如何学Python. If I remove them from GAC the loading of Unity config fails.If I try and call the Unity Resolve method from a simple Windows application Unity loads everything fine regardless of whether all my assemblies are in GAC or not.
So what settings of assembly resolver am I missing in my Visual Studio Test configuration so Unity works without need of GAC deployment?
I have found my problem.
I was missing several output files in the Out folder of the Visual Studio test.
All I had to do was to add a new deployment folder in the Test settings.
I went to local.testSettings, then selected Deployment and then added my bin folder as deployment item.
Now Visual Studio copies all files from the Bin to the Out folder and everything works like charm.
Hope it will save some time to someone in the same situation like mine :)
精彩评论