Visual Studio Build Marcos

來源:互聯網
上載者:User

如果你想在你的工程中使用Post-Build event來協助你完成一些繁瑣的動作, 比如拷貝檔案, 安裝dll到GAC, 或者使用別的命令列工具來做一些自動化的操作, 那麼你就需要瞭解Visual Studio Build Marcos.

 

在Pre-Build Event Command Line的編輯器中, 點擊下面的Macro按鈕, 可以看到可用的Marco列表以及, 它們對應的值.

 

下面的連結中有這些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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.