Saturday, November 21, 2009

Visual Studio Post Build Event to Copy DLLs into one Directory

*Updated 30th March 2010*

Basically I have this problem: I have a big solution with several projects.  Each  project builds into a dll which gets placed in its Bin directory at the project level.  All the necesary dlls are also included in the bin directory.  However, I want to be able to colllect all dlls for the solution into one folder for me to easily deploy onto the live server.

Put this into the Post Build Event in each of your projects:

xcopy /y $(ProjectDir)$(OutDir)$(TargetFileName) $(SolutionDir)GAC\

This will take the all output files from the current project and copy it to the solution root and into the folder called GAC.  Doing this to each of the projects will give you the collection of dlls in that GAC folder.

If you want to only do this on Release Build add:


if $(ConfigurationName) == Release xcopy ...

31 comments:

dries hoebeke said...

I used this to help publish my clickonce deployment and it's working nicely! cheers mate

dotnetdave said...

"$(TargetPath)" can be used instead of '$(ProjectDir)$(OutDir)$(TargetFileName)' to reference the primary output file for the project, and it is advisable to wrap these arguments in double quotes to make it impervious to spaces in the path

michaelmairegger said...

Thanks. The only I have to complain is, that it is better to write quotes around the paths in order to preserve getting Error Code 4 with xcopy

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Limro said...

It still works in 2013 - thanks a lot

Limro said...

It still works in 2013 - thanks a lot

Anonymous said...

What's up, its fastidious article regarding media print, we all understand media is a wonderful source of facts.
Also visit my homepage ... Found It

Anonymous said...

sdfasdfasdfsd

Anonymous said...

I visited many web sites except the audio quality for audio songs present at this web
site is truly excellent.

My web-site; his response

Anonymous said...

Keep on working, great job!

My web page ... best stretch mark removal method

Anonymous said...

I comment when I especially enjoy a post on a blog or I
have something to add to the discussion. Usually it is triggered by the sincerness displayed in the post I looked at.
And after this post "Visual Studio Post Build Event to Copy DLLs into one Directory".
I was actually moved enough to post a thought
;) I do have 2 questions for you if it's allright. Could it be just me or does it appear like a few of the remarks come across as if they are coming from brain dead visitors? :-P And, if you are writing on other sites, I would like to follow you. Would you list the complete urls of your public sites like your linkedin profile, Facebook page or twitter feed?

Have a look at my web blog - hotel discounts

Anonymous said...

Thank you, I've recently been searching for info approximately this subject for a while and yours is the greatest I've discovered till now.
However, what about the bottom line? Are you certain in regards to
the source?

my page: over the counter weight loss pills

Anonymous said...

Everything is very open with a very clear description of the challenges.
It was definitely informative. Your site is very useful.
Thank you for sharing!

My web site ... found here

Anonymous said...

I like the valuable info you provide in your articles.
I'll bookmark your blog and check again here frequently. I am quite sure I'll learn many new stuff right here!

Best of luck for the next!

Also visit my web blog - propertywide.co.uk

Anonymous said...

Woah! I'm really loving the template/theme of this website. It's simple, yet effective.
A lot of times it's difficult to get that "perfect balance" between superb usability and visual appearance. I must say you've done a great job with this.
Additionally, the blog loads very fast for me on Safari.
Excellent Blog!

Here is my page :: Propertywide.co.uk

Anonymous said...

It's really a nice and helpful piece of info. I'm
glad that you shared this helpful info with us.
Please stay us informed like this. Thanks for sharing.

my web blog: their explanation

Anonymous said...

Hello there! This is my 1st comment here so I just wanted to give a quick shout
out and tell you I genuinely enjoy reading your posts.
Can you recommend any other blogs/websites/forums that deal with the same subjects?
Thanks for your time!

Also visit my weblog; that guy

Anonymous said...

You need to take part in a contest for one of the highest quality sites on the net.
I am going to highly recommend this web site!

my web page: http://www.propertywide.co.uk/buy/search/monmouthshire/house

Anonymous said...

Hi there to every single one, it's really a pleasant for me to visit this website, it contains important Information.

Feel free to surf to my blog post - linked here

Anonymous said...

Pretty nice post. I just stumbled upon your blog and
wished to say that I have really enjoyed browsing your blog posts.
After all I will be subscribing to your rss feed and I hope you write again
soon!

Here is my website ... belgravia villa

Anonymous said...

Elegance is it beautiful? Getting buѕiness on foг one
in shinу oг mat finish leathеr. Fοr business moгe info: In ordeг to havе success toԁay.
The agеnt, manаger, coach and team will face challenge,
but togеther they wіll all bе worth
it if thе cuѕtomег buys from уou and complains thаt you геаlise the mistakе аnd cаn
correсt іt. If the Touch Pаd liquidatіon аlso highlighteԁ а lack of dilligence, input anԁ persеverance.


Аlso ѵіsit my webpаge - seo internet marketing consulting

Anonymous said...

Incredible points. Great arguments. Keep up the amazing effort.


Feel free to surf to my blog ... waist to height ratio calculator

Anonymous said...

This article is really a fastidious one it assists new net viewers,
who are wishing in favor of blogging.

Also visit my page ... facebook.com.bd

Anonymous said...

Hi, i think that i saw you visited my web site so
i came to “return the favor”.I am trying to find things
to enhance my site!I suppose its ok to use some of your
ideas!!

My blog post - diets that work for women

Anonymous said...

However, the decline was temporary, the investigators found that DNA methylation was absent in a region of the IL17 RC gene in twins with AMD.

The case, one could understand if he asked for a
private security company at the time of their wedding, he even went so far as to contemplate pinning his
famously large ears back. Seventeen also has a rare vascular disease Wagoner is element simply speaking my
immune system is attacking my blood vessels.

my weblog; breast Implant

Anonymous said...

She low price yeastrol cut back on unhealthy calories from sugar.
The amount of salt in eight ounces of warm water.

Check out my weblog :: yeastrolrevealed.com

Anonymous said...

You're so interesting! I don't believe I've truly read through a single thing like this before. So great to find somebody with a few original thoughts on this subject matter. Seriously.. many thanks for starting this up. This website is one thing that's needed on the internet, someone with some originality!



my web site: how to get rid of stretch marks

Anonymous said...

Hi there! I could have sworn I've visited this site before but after going through many of the articles I realized it's new to me.

Regardless, I'm definitely delighted I came across it and I'll be
book-marking it and checking back regularly!

my website: stretch mark lotion

Anonymous said...

I am sure this piece of writing has touched all the internet visitors,
its really really good piece of writing on building up new blog.



Feel free to surf to my blog post see post

Anonymous said...

I all the time used to read piece of writing in news papers but now as I am a user of internet so from now I am
using net for posts, thanks to web.

Look into my website: official statement

Post a Comment