I have a situation where I want to copy the output assembly from one project into the output directory of my target application using MSBuild, without hard-coding paths in my MSBuild Copy task. Here's the scenario:
- Project A - Web Application Project
- Project B - Dal Interface Project
- Project C - Dal Implementation Project
There is a Business layer too, but has no relevance for the MSBuild problem I'm looking to solve.
My business layer has a reference to my Dal.Interface project. My web project has a reference to the Business layer and as it stands, doing a build will pull the business layer and Dal.Interface projects into the output. So far, so good. Now in order for the web app to run, it needs the Dal implementation. I don't want the implementation referenced anywhere since I want to enforce coding to the interface and not having a reference means it won't show up in intellisense, etc.
So I figured I could handle this through the MSBuild copy operation as an AfterBuild task (I have the Dal Implementation setup to build when the web project builds, just not referenced). I don't want to hard code paths or anything else in the MSBuild params, so I'm trying to figure out how to reference the output of the Dal project from the Web Application Project's MSBuild file.
So based on the projects mentioned above this is what I want to see happen:
- Web app build is kicked off
- All required projects build (already configured, so this is done)
- MSBuild "AfterBuild" task kicks off and the output from Project C (Dal Implementation) is copied to the Bin directory of Project A (web app)
Part 3 is where I'm stuck.
I'm sure this can be done, I'm just not finding a good reference to help out. Thanks in advance for any help.