MsBuildタスクを作成しました:MyTask。私のソリューションには、タスクプロジェクトとその他のプロジェクトがあります。MyTaskは、3番目のアセンブリ(たとえば(dep1およびdep2))を参照するプロジェクト(たとえばProjA)を参照します。
プロジェクトはすべてうまくビルドされ、1つのディレクトリに出力があります(コンパイル)。このディレクトリには、必要なすべてのdllがあります:MyTask.dll、ProjA.dll、dep1.dll、dep2.dllなど。
私のMsBuildファイルには、カスタムタスクアセンブリが含まれています。
<UsingTask AssemblyFile="..\Compil\MyTask.dll" TaskName="CreateSitesCss" />
次に、MyTaskアセンブリのタスクを呼び出します。呼び出しは適切に実行されますが、MsBuildはdep1アセンブリとdep2アセンブリが見つからないことについて文句を言います(同じディレクトリにありますが):
エラー:ファイルまたはアセンブリ'dep1、Version = 2.0.0.0、Culture = neutral、PublicKey Token=9109c11469ae1bc7'またはその依存関係の1つを読み込めませんでした。システムは、指定されたファイルを見つけることができません。
dep1.dllとdep2.dllをc:\ windows \ microsoft .net \ framework \ v4.0 \にコピーすることでこの問題を解決できますが、他のプロジェクトをビルドするときに問題が発生するため、これは行いたくありません( t dep1.dllとdep2.dllを出力ディレクトリにコピーします...)。
誰かが同じ問題、またはより良い解決策を持っていますか?
編集
これがFusionLogViewerの出力です
*** Assembly Binder Log Entry (19/10/2010 @ 17:52:45) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = HEADOFFICE\bbaumann
LOG: DisplayName = ProjA
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: ProjA | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
WRN: Not probing location file:///d:/svn/twilight/_build/ProjA.DLL, because the location falls outside of the appbase.
WRN: Not probing location file:///d:/svn/twilight/_build/ProjA/ProjA.DLL, because the location falls outside of the appbase.
WRN: Not probing location file:///d:/svn/twilight/_build/ProjA.EXE, because the location falls outside of the appbase.
WRN: Not probing location file:///d:/svn/twilight/_build/ProjA/ProjA.EXE, because the location falls outside of the appbase.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/ProjA.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/ProjA/ProjA.DLL.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/ProjA.EXE.
LOG: Attempting download of new URL file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/ProjA/ProjA.EXE.
LOG: All probing URLs attempted and failed.
そして、すべてのdllがあるディレクトリにMsBuild.exeをコピーすると、正常に機能します...
MsBuildは、ProjA.dllが見つかったとしても、Compilディレクトリでdep1.dllとdep2.dllを検索しないようです。 。
編集
私のバインディングがどのように行われるかについて:MyTaskは次の方法でProjAプロジェクトを参照します:
<ProjectReference Include="..\ProjA\ProjA.csproj">
<Project>{ED61DCC3-D759-4D44-B802-A6A46F328402}</Project>
<Name>ProjA</Name>
</ProjectReference>
ProjAは2つの依存関係を次のように参照します
<Reference Include="dep1, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Dependencies\dep1\dep1.dll</HintPath>
</Reference>
<Reference Include="dep2, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Dependencies\dep2\dep2.dll</HintPath>
</Reference>