Visual Studio Build Action Copy to Output Directory Not Working


February 9, 2019 | Posted in .Net

So here’s an interesting one. I have been working on other systems and it has been a while since I’ve worked on the particular system i’m on now. I add a new library, and needed to have an xsl file copy itself to the main application bin folder – there is a dependency on it to render some XML which then displays a simple report style invoice in a standard .Net web browser control.

Anyway, even though I had the file set to:

Build Action: Content

Copy to Output Directory: Copy always

I couldn’t understand why the file wasn’t being copied to the main bin folder where it needed to be. There was a very simple explanation and something I had completely overlooked, so perhaps this may help someone else in the same situation. You just need to make sure the project that hosts the file you want in the main bin folder is reference from the main application library, that’s it.

Leave a comment in the comments section if this helped you.

Read More →