.Net Web アプリケーションを公開するには、カスタム ビルド タスクを呼び出す必要があります。このタスクは、変換された web.config を取得し、特定のプロバイダーを使用して特定のセクションを保護します。タスクを定義するアセンブリは、プロジェクトと共にコンパイルされます。
このタスクでは、web.config セクションを正常に保護するために、特定のアセンブリを読み込む必要があります。必要なアセンブリ dll は、プロパティによってタスクに渡され、Assembly.LoadFrom() によって読み込まれます。
$(_WebConfigTransformOutput) プロパティによって、変換された web.config を取得することに既に成功しています。ただし、ツールを呼び出すときは、コンパイルされてパッケージに含まれるいくつかのアセンブリの場所が必要です。
私の質問は、PackageTmp ディレクトリにコピーされた dll を参照する方法です。そのディレクトリの場所を参照するプロパティが見つからないようです。
ビルド ターゲットの例 (Encrypt タスクはカスタム インクルード タスクであり、$(Somelocation?) は最終的にパッケージの bin ディレクトリを指す必要があります):
<Target Name="EncyptWebConfig" AfterTargets="PipelineCollectFilesPhase">
<PropertyGroup>
<ConfigFile>$(_WebConfigTransformOutput)</ConfigFile>
<Sections>
connectionStrings;
caracal/authenticationSettings;
caracal/cookieAuthentication;
system.net/mailSettings;
</Sections>
<!-- The first assembly contains the SecurityProvider,
The second and third assemblies are for the caracal/* sections
-->
<Assemblies>
$(Somelocation?)\ConfigProtectionAssembly.dll;
$(Somelocation?)\Caracal.Application.dll;
$(Somelocation?)\Caracal.AuthenticationModule.dll;
</Assemblies>
<Provider>CaracalConfigEncryption</Provider>
</PropertyGroup>
<Encrypt ConfigFile="$(ConfigFile)" Assemblies="$(Assemblies)" Provider="$(Provider)" Sections="$(Sections)"/>