Reputation: 1678
So looking at this post, VS2010 How to include files in project, to copy them to build output directory automatically during build or publish.
This seems to be pretty close to what I am looking to do, however what I want is to have the .exe that is built be copied to a second output directory.
To help explain, when I build/rebuild my project/solution the .exe's are put in
[somepath]\Projects\[NameOfSolution]\[NameOfProject]\bin\Release\outputFile.exe
What I would like to do is have visual studio automatically make a copy of that outputFile.exe
to some other directory, like say a server share on the network that I have read/write access to. The catch is that server share is not always available since I write my code on a traveling laptop. So need to have some sort of logic to check for that I guess...
I truly don't even know where to begin; if it's even possible to do it in Visual Studio. I tried looking into post-build actions in my project settings, but I have no idea what to do in the dialog box. I tried Googling how to do it, but since I don't even know how to explain what I want very well, the google results were useless.
Upvotes: 0
Views: 1599
Reputation: 1678
This is in fact a duplicate of Copy file(s) from one project to another using post build event...VS2010
Like I said, I didn't know how to explain what I wanted, so when I searched I didn't find relevant results.
In case anyone comes to this question via a google search in the future, the following Post-Build Event command worked for me (has to all be on one line):
if $(ConfigurationName) == Release copy /B /Y /V "$(TargetPath)" "\\some\path\to\file\share\$(TargetFileName)"
Upvotes: 1