Ho scritto un MsBuild Task: MyTask. Nella mia soluzione, ho il progetto Task e altri progetti. MyTask fa riferimento a un progetto (ad esempio ProjA) che fa riferimento a terzi assiemi, ad esempio (dep1 e dep2).MsBuild non appare nella directory corretta per le dipendenze di secondo livello delle attività personalizzate
I progetti tutto funziona bene e ho gli output in una directory (Compil). In questa directory ho tutte le DLL che voglio: MyTask.dll, ProjA.dll, dep1.dll, dep2.dll e altri.
Nel mio file MsBuild includo l'assembly attività personalizzato con:
<UsingTask AssemblyFile="..\Compil\MyTask.dll" TaskName="CreateSitesCss" />
Poi io chiamo un compito dell'assemblea MyTask. La chiamata è ben eseguito, ma MsBuild lamenta di non trovare le assemblee dep1 e dep2 (anche se sono nella stessa directory):
errore: Impossibile caricare il file o l'assembly 'dep1, Version = 2.0.0.0, Culture = neutro, Token PublicKey = 9109c11469ae1bc7 'o una delle sue dipendenze. Il sistema non trova il file specificato.
posso risolvere questo problema copiando dep1.dll e dep2.dll in c: \ windows \ Microsoft .NET \ Framework \ v4.0 \ ma non voglio fare questo perché si innesca problemi quando costruzione di altri progetti (non copierà dep1.dll e dep2.dll nella directory di output ...).
Qualcuno ha lo stesso problema, o meglio, una soluzione?
EDIT
Ecco l'output di 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.
E Se copio MSBuild.exe nella directory in cui tutta la mia dll sono, funziona benissimo ..
MsBuild non sembra cercare dep1.dll e dep2.dll nella mia directory Compil anche se trova ProjA.dll entro ...
EDIT
Quanto a come i miei attacchi sono fatti: MyTask fa riferimento al Progetto proja da:
<ProjectReference Include="..\ProjA\ProjA.csproj">
<Project>{ED61DCC3-D759-4D44-B802-A6A46F328402}</Project>
<Name>ProjA</Name>
</ProjectReference>
proja fa riferimento ai due dipendenze da
<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>
possibile duplicato del [compiti Usa personalizzato MSBuild dalla stessa soluzione?] (Http://stackoverflow.com/questions/282615/use-custom-msbuild-tasks-from-the-same-solution) –
No. Avevo visto l'argomento che linkavi. Nel suo caso, msbuild non può caricare l'assembly del task perché il percorso non è buono. Nel mio caso, l'attività è ben caricata, anche la prima dipendenza (ProjA) ma le dipendenze di secondo livello (dep1 e dep2) non lo sono. –
Hai mai trovato una soluzione * corretta * a questo problema? Penso di avere lo stesso problema adesso. – theDmi