Я написал задачу MsBuild: MyTask. В моем решении есть проект Task и другие проекты. MyTask ссылается на проект (скажем, ProjA), который ссылается на третьи сборки, скажем (dep1 и dep2).
Все проекты строятся хорошо, и у меня есть результаты в одном каталоге (Compil). В этом каталоге у меня есть все необходимые мне библиотеки DLL: MyTask.dll, ProjA.dll, dep1.dll, dep2.dll и другие.
В моем файле MsBuild я включаю сборку настраиваемой задачи с помощью:
<UsingTask AssemblyFile="..\Compil\MyTask.dll" TaskName="CreateSitesCss" />
Затем я вызываю задача сборки MyTask. Вызов выполняется хорошо, но MsBuild жалуется на то, что не находит сборки dep1 и dep2 (хотя они находятся в одном каталоге):
ошибка: не удалось загрузить файл или сборку dep1, версия = 2.0.0.0, культура = нейтральная, PublicKey Token = 9109c11469ae1bc7 'или одну из его зависимостей. Система не может найти указанный файл.
Я могу решить эту проблему, скопировав dep1.dll и dep2.dll в c: \ windows \ microsoft .net \ framework \ v4.0 \, но я не хочу этого делать потому что это вызывает проблемы при сборке других проектов (не копирует dep1.dll и dep2.dll в выходной каталог ...).
Есть ли у кого-нибудь такая же проблема или, лучше, решение?
EDIT
Вот результат Fusion Log Viewer
*** 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.
. И если я скопирую MsBuild.exe в каталог, где находятся все мои dll, он будет работать нормально ...
Кажется, что MsBuild не ищет dep1.dll и dep2.dll в моем каталоге Compil, даже если он находит ProjA.dll в ...
EDIT
Что касается того, как выполняются мои привязки: MyTask ссылается на проект ProjA:
<ProjectReference Include="..\ProjA\ProjA.csproj">
<Project>{ED61DCC3-D759-4D44-B802-A6A46F328402}</Project>
<Name>ProjA</Name>
</ProjectReference>
ProjA ссылается на две зависимости посредством
<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>