2014-10-07 6 views
20

Ho visto questo in un file di progetto, l'altro giorno:Cosa fa l'impostazione Privata su un ProjectReference in un file di progetto MSBuild?

<ProjectReference Include="Foo\Bar\Baz.csproj"> 
    <Project>{A GUID HERE}</Project> 
    <Name>Baz</Name> 
    <Private>False</Private> <!-- ??? --> 
    <ReferenceOutputAssembly>False</ReferenceOutputAssembly> 
</ProjectReference> 

Ogni nodo in un ProjectReference sembra essere auto esplicativo (il file di progetto di riferimento, GUID, il nome da mostrare nella soluzione explorer, e se non il progetto corrente dovrebbe collegarsi al progetto di riferimento) eccetto Private e la pagina Common MSBuild Project Items non documenta questo valore. (C'è un ambiente Private documentata per Reference piuttosto che ProjectReference - ma ha Never, Always, e PreserveNewest impostazioni, non vere e false)

Cosa impostazione fare?

+1

Per quanto MSBuild è interessato, ProjectReference è un gruppo di elementi (cioè elenco) e Privato sono metadati oggetto per l'elemento incluso. La risposta alla tua domanda si trova in ciò che nessuno include fare con esso. In termini più generali, quale tipo specifico di progetto è? Forse tagga la tua domanda con csharp. –

+0

Intendevo "Importa" non "include". –

+0

@malexander: Penso che la tua risposta sia stata buona se l'avessi ripristinata ... –

risposta

34

Il tag Private mantiene la sovrascrittura dell'utente nella casella di controllo "Copia locale" nella cartella Riferimenti di Visual Studio. Questo controlla se il riferimento viene utilizzato dal GAC o se copierà l'assembly di riferimento nella directory di build.

Mentre non posso trovare alcuna documentazione MSDN in tal senso (Quelle sorpresa), è evidente dal comportamento e dal commento in Microsoft.Common.CurrentVersion.targets:1620 in cui viene applicato:

<!-- 
    ============================================================ 

             ResolveAssemblyReferences 

    Given the list of assemblies, find the closure of all assemblies that they depend on. These are 
    what we need to copy to the output directory. 

     [IN] 
     @(Reference) - List of assembly references as fusion names. 
     @(_ResolvedProjectReferencePaths) - List of project references produced by projects that this project depends on. 

      The 'Private' attribute on the reference corresponds to the Copy Local flag in IDE. 
      The 'Private' flag can have three possible values: 
       - 'True' means the reference should be Copied Local 
       - 'False' means the reference should not be Copied Local 
       - [Missing] means this task will decide whether to treat this reference as CopyLocal or not. 

     [OUT] 
     @(ReferencePath) - Paths to resolved primary files. 
     @(ReferenceDependencyPaths) - Paths to resolved dependency files. 
     @(_ReferenceRelatedPaths) - Paths to .xmls and .pdbs. 
     @(ReferenceSatellitePaths) - Paths to satellites. 
     @(_ReferenceSerializationAssemblyPaths) - Paths to XML serialization assemblies created by sgen. 
     @(_ReferenceScatterPaths) - Paths to scatter files. 
     @(ReferenceCopyLocalPaths) - Paths to files that should be copied to the local directory. 
    ============================================================ 
    --> 
Problemi correlati