Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a folder in bin/Release for Visual Studio Project?

How to create a folder in bin/Release for Visual Studio Project?

My project calls external exe file, and I would like to place that exe file in bin/Release/External. But every time I rebuild my project everything is removed, so I can't just manually copy the file there. How should I do it?

like image 308
user3111311 Avatar asked Apr 15 '14 09:04

user3111311


People also ask

How to copy files to the build folder of a project?

For files, residing outside of the project folder working with Post build events provides the capability to copy files to the build folder of a project. Select project properties. Select the Compile tab for VB.NET, Build Events for C#.. In the bottom right hand corner select the Build Events... button (VB.ET only).

How do I copy a build event file to another folder?

To copy this file to the build folder of the project, open the dialog for build events and replace the echo command with the following command, The absolute path name of the primary output file for the build (defined with drive, path, base name, and file extension). Macros in the post-build event editor.

Why doesn't my project have DLLs in its bin folder?

So if your project creates an application, it will not place any DLLs into your bin folder. And if your project builds a library, you'll get an error when you try to debug it because you cannot execute a DLL.

How do I add an EXE file to a project?

The simplest way of doing it is by adding the desired folder to your project and the exe file on the folder. Change the properties of the exe file to "Content" and "Copy always".


3 Answers

The folders inside the bin folder of your project are always deleted when you clean your solution (unless you change the project properties, but this won't solve your problem).

The simplest way of doing it is by adding the desired folder to your project and the exe file on the folder. Change the properties of the exe file to "Content" and "Copy always".

By doing that, everytime you rebuild your solution, the output will have the folder and exe file.

If the Exe file changes, you can add it as a link; ensuring you will have the latest version every time.

like image 139
Nahuel Ianni Avatar answered Sep 30 '22 23:09

Nahuel Ianni


Or another way again..

Use Post build event where you write DOS commands.

For example in your case you can write:

mkdir  $(TargetDir)\External
xcopy  SOURCE_DIR_EXE   $(TargetDir)\External\EXE_NAME
like image 23
Tigran Avatar answered Oct 01 '22 00:10

Tigran


create a folder in the project, place the exe file in it, and set "Copy To Output Directory" property to "Copy if newer".

like image 28
Felice Pollano Avatar answered Sep 30 '22 23:09

Felice Pollano