Visual Studio not copying assemblies to output directory

Today’s not a good day for my coding. I planned to do database design and data access logic using Simple.Data and everything was going wrong. Outdated version of Simple.Data.PostgreSql, had to download code from github manually. Thanks to Maciej Aniserowicz this project was recently updated to later version of Simple.Data. But along the way I was stumbling upon one issue after another. I don’t like those days when tools are mostly in the way of getting work done and not helping at all.

My biggest complain today will be Visual Studio. Yes, it is big and slow. But it is also pretty damn good IDE. Add Resharper to it and sky is the limit. Well, on my fun projects I’m using Visual Studio Express mainly because it is for free. So no Resharper magic for me, no plugins, but it’s free – I don’t complain (too much). I have two versions installed: Visual Studio 2013 for Desktop and Visual Studio 2013 for Web. Today for the first time in quite a while I started desktop development version to build quick proof of concept console application. At some point I started getting exception from library. But I could not view it! Apparently exception assistant, this fancy floating window that appears when something went terribly wrong, was removed form VS2013 for Desktop. Why? I have no idea, but I am greatly disappointed. You can read about reported issue (and vote for a fix) here: Enable Exception Assistant option missing from VS2012 Express For Desktop

But then the main issue came and hit me when I least expected it. Imagine situation where you have main project A which references project B. Classic situation. B further references few dll libraries: B1, B2, B3. But it explicitly uses only B1, rest is used through reflection or something. Now – I would expect, and I’m pretty sure that’s how it worked previously, that all three dlls will get copied to A‘s output directory. Since I created reference I know it’s there for some reason and would like VS to respect it. However no, that won’t happen. Does not matter if you have Copy Local set to true for all libraries – only B1 will be deployed since it is the only one used. Took me way too much time to figure it out.

You can look at this issue here:
Visual Studio does not copy referenced assemblies through the reference hierarchy
and vote for this to be fixed. VS team decided not to fix it since it has not enough votes. I don’t get the logic behind this – it seems to me like basic functionality is broken and they decide not to do anything about it.

Of course this issue is simple to work around – you can either reference the same libraries in A project or create after-build task to copy them. It will work, but it is far from perfect – now there are two places you need to remember to modify if you will start messing with references. IDE should be there to help you, not to make it harder.

Advertisements

One thought on “Visual Studio not copying assemblies to output directory

  1. ty. Great work! I updated my project from VS12 (where this worked as expected) to VS13 and missed my libs. The Copy Local attribute was automatically set to false on “migration”. I agree with you that this should be fixed – but at least it´s implemented consequent ;-)

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s