If you want to use Post-Build event in your project to help you complete some tedious operations, such as copying files and installing dll to GAC, you can also use other command line tools to perform automated operations, so you need to understand Visual Studio Build Marcos.
In the Pre-Build Event Command Line editor, click the Macro Button below to view the available Marco list and their corresponding values.
The following link provides a complete list and description of these Marco.
Here is an example:
Use the following code as the Post-Build command:
Echo RemoteMachine = $ (RemoteMachine)
Echo References = $ (References)
Echo ConfigurationName = $ (ConfigurationName)
Echo PlatformName = $ (PlatformName)
Echo Inherit = $ (Inherit)
Echo NoInherit = $ (NoInherit)
Echo StopEvaluating = $ (StopEvaluating)
Echo ParentName = $ (ParentName)
Echo RootNameSpace = $ (RootNameSpace)
Echo IntDir = $ (IntDir)
Echo OutDir = $ (OutDir)
Echo DevEnvDir = $ (DevEnvDir)
Echo InputDir = $ (InputDir)
Echo InputPath = $ (InputPath)
Echo InputName = $ (InputName)
Echo InputFileName = $ (InputFileName)
Echo InputExt = $ (InputExt)
Echo ProjectDir = $ (ProjectDir)
Echo ProjectPath = $ (ProjectPath)
Echo ProjectName = $ (ProjectName)
Echo ProjectFileName = $ (ProjectFileName)
Echo ProjectExt = $ (ProjectExt)
Echo SolutionDir = $ (SolutionDir)
Echo SolutionPath = $ (SolutionPath)
Echo SolutionName = $ (SolutionName)
Echo SolutionFileName = $ (SolutionFileName)
Echo SolutionExt = $ (SolutionExt)
Echo TargetDir = $ (TargetDir)
Echo TargetPath = $ (TargetPath)
Echo TargetName = $ (TargetName)
Echo TargetFileName = $ (TargetFileName)
Echo TargetExt = $ (TargetExt)
Echo VSInstallDir = $ (VSInstallDir)
Echo VCInstallDir = $ (VCInstallDir)
Echo FrameworkDir = $ (FrameworkDir)
Echo FrameworkVersion = $ (FrameworkVersion)
Echo FrameworkSDKDir = $ (FrameworkSDKDir)
Echo WebDeployPath = $ (WebDeployPath)
Echo WebDeployRoot = $ (WebDeployRoot)
Echo SafeParentName = $ (SafeParentName)
Echo SafeInputName = $ (SafeInputName)
Echo SafeRootNamespace = $ (SafeRootNamespace)
Echo FxCopDir = $ (FxCopDir)
The result is as follows:
------ Build started: Project: MacroExposition, Configuration: Debug
Any CPU ------
MacroExposition->
C: \ sandbox \ MacroExposition \ bin \ Debug \ MacroExposition.exe
Echo RemoteMachine =
Echo References =
Echo ConfigurationName = Debug
Echo PlatformName = AnyCPU
Echo Inherit =
Echo NoInherit =
Echo StopEvaluating =
Echo ParentName =
Echo RootNameSpace = MacroExposition
Echo IntDir =
Echo OutDir = bin \ Debug \
Echo DevEnvDir = C: \ Program Files \ Microsoft Visual Studio 8 \ Common7 \ IDE \
Echo InputDir =
Echo InputPath =
Echo InputName =
Echo InputFileName =
Echo InputExt =
Echo ProjectDir = C: \ sandbox \ MacroExposition \
Echo ProjectPath =
C: \ sandbox \ MacroExposition. csproj
Echo ProjectName = MacroExposition
Echo ProjectFileName = MacroExposition. csproj
Echo ProjectExt =. csproj
Echo SolutionDir = C: \ sandbox \ MacroExposition \
Echo SolutionPath = C: \ sandbox \ MacroExposition. sln
Echo SolutionName = MacroExposition
Echo SolutionFileName = MacroExposition. sln
Echo SolutionExt =. sln
Echo TargetDir = C: \ sandbox \ MacroExposition \ bin \ Debug \
Echo TargetPath =
C: \ sandbox \ MacroExposition \ bin \ Debug \ MacroExposition.exe
Echo TargetName = MacroExposition
Echo TargetFileName = MacroExposition.exe
Echo TargetExt =. exe
Echo VSInstallDir =
Echo VCInstallDir =
Echo FrameworkDir = c: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727
Echo FrameworkVersion =
Echo FrameworkSDKDir = C: \ Program Files \ Microsoft Visual Studio 8 \ SDK \ v2.0 \
Echo WebDeployPath =
Echo WebDeployRoot =
Echo SafeParentName =
Echo SafeInputName =
Echo SafeRootNamespace =
Echo FxCopDir =
From:
Visual studio build macros
Http://billfellows.blogspot.com/2009/09/visual-studio-build-macros.html
Macros for Build Commands and Properties
Http://msdn.microsoft.com/en-us/library/c02as0cs (VS.71). aspx
Http://msdn.microsoft.com/en-us/library/c02as0cs.aspx