Что делает личный параметр для ProjectReference в файле проекта MSBuild?

Я видел это в файле проекта на следующий день:

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

Каждой node в ProjectReference кажется самоочевидной (файл проекта, GUID, имя, отображаемое в проводнике решений, и должен ли текущий проект ссылаться на указанный проект), кроме Private, а Общие объекты проекта MSBuild не документируют это значение. (Там параметр Private, задокументированный для Reference, а не ProjectReference - но он имеет настройки Never, Always и PreserveNewest, а не true и false)

Что делает эта настройка?

Ответы

Ответ 1

Private тег поддерживает переопределение пользователя для флажка "Копировать локальный" в папке "Ссылки на Visual Studio". Это контролирует, используется ли ссылка из GAC или скопирует ссылочную сборку в каталог сборки.

Хотя я не могу найти какую-либо документацию MSDN по этому поводу (неожиданный сюрприз), это видно из поведения и из комментария в Microsoft.Common.CurrentVersion.targets:1742 где он применяется:

Это задокументировано в MSDN> Общие элементы проекта MSBuild, и это видно из поведения и из комментария в Microsoft.Common.CurrentVersion.targets:1742 где он применяется:

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

                                        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.
    ============================================================
    -->