Copying project dependencies using Visual Studio

I used to only use NAnt to copy dependencies around a project, due to me being familiar with it as well as Nant having many other useful features. However I wondered the other day whether there was anything more simple and quicker to set up than going the whole hog and using Nant. Reason being – I’ve found that I do a lot of smaller projects that don’t have the need for the lengthy Nant installation and setup.

I guess up until this point, I had never really looked in Visual Studio for this functionality. Any way, cutting to the chase:

Right click your main project that you want copying from, select properties. Then select the Build Events Tab. In the Pre-build event command line throw in something like below to get your copy going.

copy "$(ProjectDir)Web.config" "$(SolutionDir)Move.Tests\bin\Debug\Move.Tests.dll.config"

If you are unsure as to your options, click the Edit Pre-build button and hit the macro button. It will show you the tokenized values for common build properties such as $(ProjectDir).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s