Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In a Visual Studio pre-build event how do I execute an exe in the context of its own folder instead of the bin folder?

I have a pre-build event defined like this:

$(ProjectDir)PreBuild\runthis.exe

When the runthis.exe executes, it runs in the context of the bin folder of my project instead of the PreBuild folder where it lives. How can I make the build event execute runthis.exe in the context of the PreBuild folder instead of the bin folder?

like image 232
Rafe Avatar asked Dec 07 '12 16:12

Rafe


People also ask

How to use Post-build event in Visual Studio?

In the Post-build event command line box, specify the syntax of the build event. Add a call statement before all post-build commands that run . bat files. For example, call C:\MyFile.

How do I open a build event in Visual Studio?

Go to the Solution Explorer the right-click the project then select Properties then go to the Build Events tab. Now if you build the project based upon the selection of configuration name , the Web. config file will be updated.

How do I add post-build event in Visual Studio to copy DLL?

To switch this on in visual studio, go to Tools/Options then scroll down the tree view to the section called Projects and Solutions, expand that and click on Build and Run, at the right their is a drop down that specify the build output verbosity, setting that to diagnostic, will show you what other macro values you ...

How do I run a batch file in post-build event?

If you go to the Properties page for your project, you should select the Build Events tab. You can type in the call to your batch file in the Post-build event command line text box. If you want to refer to the batch file using the paths included in the project or solution, you can click on the Edit Post-Build...


1 Answers

Add cd $(ProjectDir)PreBuild first to switch to that folder.

like image 81
SLaks Avatar answered Oct 21 '22 05:10

SLaks