MSDeployを介したパッケージ化/展開プロセスの一部としてコマンドを実行しようとしています。特に、DLLの1つに対してinstallutilを実行してカスタムイベントログを作成しようとしていますが、展開ディレクトリからDLLへの相対パスを指定するのに問題があります。まず、マニフェストファイル内にrunCommandプロバイダーを生成するために、以下の構成をcsprojに追加しました。DLLへの絶対パスに注意してください。
<PropertyGroup>
<!-- Extends the AfterAddIisSettingAndFileContentsToSourceManifest action to create Custom Event Log -->
<IncludeEventLogCreation>TRUE</IncludeEventLogCreation>
<AfterAddIisSettingAndFileContentsToSourceManifest Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)'==''">
$(AfterAddIisSettingAndFileContentsToSourceManifest);
CreateEventLog;
</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>
<Target Name="CreateEventLog" Condition="'$(IncludeEventLogCreation)'=='TRUE'">
<Message Text="Creating Event Log" />
<ItemGroup>
<MsDeploySourceManifest Include="runCommand">
<path>installutil C:\inetpub\wwwroot\MyTestApp\bin\BusinessLayer.dll</path>
</MsDeploySourceManifest>
</ItemGroup>
</Target>
<ItemGroup>
msbuildを呼び出した後、これにより、package.zip内にマニフェストが正しく生成されました。MyTestApp.deploy.cmd / Yを実行すると、msdeployが正しく呼び出され、ファイルがinetpub \ wwwroot \ MyTestAppにデプロイされ、以下のマニフェストからコマンドが実行されました。
<runCommand path="installutil C:\inetpub\wwwroot\MyTestApp\bin\BusinessLayer.dll ... etc
私が抱えている問題は、このDLLパスをc:\ inetpub\etcにハードコーディングしたくないということです。デフォルトのWebサイトの下にある展開ディレクトリからの相対パスを使用して上記の呼び出しを行うにはどうすればよいですか?理想的には、DLLを見つけるために、 MSDeployがこのパスを取得し、それを変数としてrunCommandステートメントに渡すようにします。次に、次のようなものを書くことができます<path>installutil $DeploymentDir\NewTestApp\bin\BusinessLayer.dll</path>
。に絶対パスをハードコーディングすることを心配する必要はありません。
毎回DLLへの絶対パスを使用せずにこれを行う方法はありますか?