Post-BUILD Event Command Line

关于 post-build event 的一些例子:(//z 2012-5-18 15:26:21 PM IS2120@CSDN)

if $(ConfigurationName) == Debug (
  copy "$(TargetDir)myapp.dll" "c:\delivery\bin" /y
  copy "$(TargetDir)myapp.dll.config" "c:\delivery\bin" /y
) ELSE (
  echo "why, Microsoft, why".
)

//z 2012-5-17 12:35:17 PM IS2120@CSDN
Pre:
IF NOT EXIST $(IntDir)..\..\lib mkdir $(IntDir)..\..\lib
Post:
copy $(IntDir)$(ProjectName).lib $(IntDir)..\..\lib

//z 2012-5-17 12:47:52 PM IS2120@CSDN
Add a call statement before all post-build commands that run .bat files. For example,call C:\MyFile.bat orcall C:\MyFile.bat call C:\MyFile2.bat.
Pre-build events do not run if the project is up to date and no build is triggered.


if $(ConfigurationName) == Debug goto :debug

:release
signtool.exe ....
xcopy ...

goto :exit

:debug
' debug items in here

:exit

另外一种,修改csprj
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <PostBuildEvent>start gpedit</PostBuildEvent>
</PropertyGroup>

Pre- and Post-Build Events run as a batch script. You can do a conditional statement on $(ConfigurationName).

For instance

if $(ConfigurationName) == Debug xcopy something somewhere

posted @ 2012-05-18 15:23  BiG5  阅读(145)  评论(0编辑  收藏  举报