I'm a using the repository pattern and Unity to manage the dependency to my concrete repository objects. In itself this is not an issue however I am running into a problem when using publish website in both VS and the TFS build process.
I believe the problem is being caused by the fact that although the project which contains the concrete repository objects is referenced in my application, the classes that it contains are never used directly. This is because I am using Unity to create instances of the concrete objects at runtime using the Unity config held in my web.config.
The repository project is being compiled when and included in the output when built but when publish website is used in either VS of TFS the repository assembly is missing. Therefore when the web application is deployed to the web server it is not possible to use it as you are greeted with the error:
The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
This is because Unity cannot find the missing assembly as you would expect.
So my specific question is; Is there a way to ensure that repository assembly is copied to the output directly when publishing the website in VS and TFS without directly using one of the concrete classes in the project?