Custom Bin Directory  
Author Message
The Philosiphiser





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

I have a large solution that contains around 15 projects. One of those projects is a Service Project that has an PostBuild event that copies it's dlls from it's bin\debug folder to a global BIN folder availible to all projects (about 4 directories up). I have a web service that references those dlls in the same solution. I am trying to get this to work with TFS Build and not having any luck.

Question: why is the BIN directory non-existant on my build server (where this solution is being built) Should it be there I am only seeing the "obj" directory under the project directory



Visual Studio Team System31  
 
 
Aaron Hallberg





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

I've been meaning to write a blog post on these issues, but haven't gotten around to it yet...

Team Build overrides the OutDir property for each solution it builds. It does this because it needs the various binaries to be in a common location so that it can copy them all to the drop location, point any unit tests that need to get run at them, etc. Typically your binaries will first be compiled into an intermediate directory (this is the "obj" directory) and then copied into their final output directory (within VS this is the "bin" directory, in a Team Build this is the $(BinariesRoot) directory).

So - one possibility for you is to copy the files from the intermediate directory instead of the final output directory. This should exist in both a VS build and a Team Build. Another possibility would be to use a path relative to the output directory - the Exec task MSBuild uses to execute your post build event looks like the following (this is in Microsoft.Common.targets):

<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)" />

Since the working directory is already set to $(OutDir) - which will be bin\debug in the one case, and $(BinariesRoot)\debug in the other - you should be able to just do everything relative to it.

-Aaron



 
 
liujj_xujj





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

Please tell me how to do
 
 
liujj_xujj





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

I find a way.

Try it.

1.write a task.cs ,in this file , use TFS code to link TFS , set local workspace, get the latest version, then call a bat file to compile the local source solution. In the bat file , call VS2005 compiler all projects. 'D:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe'.all projiects will be compiler to special location.

2.open build script file TFSBuild.proj , In 'CoreCompile' , call your name.

<Target Name="'CoreCompile' ">

<SimpleTask />

</Target>


 
 
Aaron Hallberg





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

In general, overriding the CoreXX tasks is not a good idea (especially CoreCompile), so I would not recommend this approach. Is your only goal to get your binaries copied to a custom location In general, there are much simpler ways to do this that do not circumvent the entire Team Build build process (e.g. using the PostBuildEvent hook, as in this thread).

-Aaron



 
 
liujj_xujj





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

Thank you for your reminded. I know that overriding the CoreXX tasks is not a good idea (especially CoreCompile).In surface, my goal is to my binaries copied to a custom location, but in fact my require is not that.

In fact , my solution include many projects, and my team project is planning and developing,so we will continue to add more projects in my solution. I don't wish when we add a project, we have to modify the build scripts to descript what file must be copyed to what folder,that's too troubles. I hope when I add a project in my solution, the Building will auto compile the project to a custom location, the custom location can be set by VS2005 IDE.

Another, I have not use PostBuildEvent hook, How to use it

Thank you


 
 
liujj_xujj





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

I think the first thing is why overriding the CoreXX tasks is not a good idea (especially CoreCompile). In fact , in this task, we can in stead of the VSTS Team Buil by ourself build or compile tool.Of course, the other build task will be impacted.(such as test).


 
 
Aaron Hallberg





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

If you right click on a project in VS and select properties, one of the tabs will be Build Events. Here you can specify a Pre-build event command line and a Post-build event command line.

-Aaron



 
 
liujj_xujj





PostPosted: Team Foundation Server - Build Automation, Custom Bin Directory Top

In the Build Events,I still must write code to console dlls one by one.That's not my wanted. I wish these dlls can auto be moved by Team Build.

So, I think use vs compiler(MSBuild) in Server locally to instead of Team Build.

When you have make a new version of the Team Build to support my requirement, I will return to use the Genuine Build tool.

Now I have to use this way to do this.

Can you give me some confidences

Thx. I learn many from you.