• Visual Studio Build Marcos


    如果你想在你的工程中使用Post-Build event来帮助你完成一些繁琐的动作, 比如拷贝文件, 安装dll到GAC, 或者使用别的命令行工具来做一些自动化的操作, 那么你就需要了解Visual Studio Build Marcos.

    在Pre-Build Event Command Line的编辑器中, 点击下面的Macro按钮, 可以看到可用的Marco列表以及, 它们对应的值.

    PostBuildEventCommandLineMacros-724657

    下面的链接中有这些Marco的完整列表和说明.

    这里举出一个例子:

    用下面的代码作为Post-Build的命令:

    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)

     

    生成的结果如下:

    ------ Build started: Project: MacroExposition, Configuration: Debug
    Any CPU ------
    MacroExposition ->
    C:\sandbox\MacroExposition\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\MacroExposition\
    echo ProjectPath =
    C:\sandbox\MacroExposition\MacroExposition\MacroExposition.csproj
    echo ProjectName = MacroExposition
    echo ProjectFileName = MacroExposition.csproj
    echo ProjectExt = .csproj
    echo SolutionDir = C:\sandbox\MacroExposition\
    echo SolutionPath = C:\sandbox\MacroExposition\MacroExposition.sln
    echo SolutionName = MacroExposition
    echo SolutionFileName = MacroExposition.sln
    echo SolutionExt = .sln
    echo TargetDir = C:\sandbox\MacroExposition\MacroExposition\bin\Debug\
    echo TargetPath =
    C:\sandbox\MacroExposition\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 =

    摘自:

    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

  • 相关阅读:
    linux系统下安全管理
    Linux查看所有用户用什么命令
    linux下配置ip地址四种方法(图文方法)
    如何在linux系统中设置静态ip地址
    算法与cpu
    汇编 分支之跳转结构程序设计--待处理文档
    从汇编的角度理解程序(二)—— 分支和循环控制
    指令计数器--Program counter
    类型的分类
    CPU的内部架构和工作原理
  • 原文地址:https://www.cnblogs.com/awpatp/p/1692509.html
Copyright © 2020-2023  润新知