Share via


how to write 2 command lines in "post build event command line " in VS 2010

Question

Wednesday, August 27, 2014 2:51 PM

hi

   may i ask how to write 2 command lines in "post build event command line " in VS 2010?

   for example:

   I want to execute 2 command lines

xcopy "$(ProjectDir)\lib\project.exe" "$(TargetDir)" /Y

xcopy "$(ProjectDir)\lib\project.exe.config" "$(TargetDir)" /Y

  In the BuildEvent how could I write? thank u very much

All replies (4)

Wednesday, August 27, 2014 3:42 PM ✅Answered

In Visual Studio 2010 SP1, I typed the following the "Post-build event command line" box of a C# project:

echo haa
echo hoo

Visual Studio saved this setting to the following property In the .csproj file:

  <PropertyGroup>
    <PostBuildEvent>echo haa
echo hoo</PostBuildEvent>
  </PropertyGroup>

When I built the project, the following appeared in the Output window:

PostBuildEvent:
  echo haa
  echo hoo
  haa
  hoo

Build succeeded.

Thus, it doesn't look like you need to do anything special. Simply put newlines between the commands.

I did not try the same with a C++ or C++/CLI project though. What type of project are you editing?


Wednesday, August 27, 2014 3:50 PM ✅Answered

Are you getting any error? Otherwise, what you are doing is correct. Just put two commands in Post Build Events section of project properties.


Thursday, August 28, 2014 6:50 AM

thank u very much


Thursday, August 28, 2014 6:50 AM

thank u very much