PostBuild eventの中でローカル変数を使用したいのですが、内部の使い方を理解できませんでした。ビルド後のイベントでユーザー定義変数を使用する方法は?
set fold=$(TargetDir)
if defined param (set fold=$(TargetDir)$(param)\)
if not exist "%fold%" md "%fold%"
copy /y "$(TargetPath)" "%fold%"
ソリューションを構築する私が手::
msbuild PrePostBuildEvents.sln /p:param=ext
...
PostBuildEvent:
set fold=G:\prj\work\PrePostBuildEvents\bin\Debug\
if defined param (set fold=G:\prj\work\PrePostBuildEvents\bin\Debug\ext\)
if not exist "%fold%" md "%fold%"
copy /y "G:\prj\work\PrePostBuildEvents\bin\Debug\PrePostBuildEvents.dll" "%fold%"
The file cannot be copied onto itself.
0 file(s) copied.
私は%fold%
を変更する場合はここに私のビルド後のイベントコマンド(param
は、MSBuildの/ pスイッチを通過させることができるという名前のパラメータがあります) $(fold)
に、私は別の結果を得るが、それはまた間違っている:
PostBuildEvent:
set fold=G:\prj\work\PrePostBuildEvents\bin\Debug\
if defined param (set fold=G:\prj\work\PrePostBuildEvents\bin\Debug\ext\)
if not exist "" md ""
copy /y "G:\prj\work\PrePostBuildEvents\bin\Debug\PrePostBuildEvents.dll" ""
The filename, directory name, or volume label syntax is incorrect.
0 file(s) copied.
私が間違ってやっていますか?
私はWindowsマシンの近くにいませんが、VSではプロジェクトプロパティにリソースタブがありますので、そこに定義すると思います。あなたは確認することができますか、後で私がWinマシンの近くにいるときにします – Mzf
私はそこに定数文字列しか定義できないと思いますが、名前付きパラメータに依存する計算可能な文字列が必要です。 – stukselbax