winforms/eng/packageContent.targets

132 строки
8.9 KiB
XML

<Project>
<PropertyGroup>
<_DotnetApiDocsPackageName>Microsoft.Private.Intellisense</_DotnetApiDocsPackageName>
<!-- Using ToLower below to unlock Linux build, even if it's unsupported. -->
<_DotnetApiDocsFilesRoot>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', '$(_DotnetApiDocsPackageName.ToLower())', '$(MicrosoftPrivateIntellisenseVersion)', 'IntellisenseFiles', 'windowsdesktop', '1033'))</_DotnetApiDocsFilesRoot>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);IncludeProjectReferencesWithPackAttributeInPackage</TargetsForTfmSpecificContentInPackage>
<!-- During NoBuild pack invocations, skip project reference build. Necessary for the IncludeProjectReferencesWithPackAttributeInPackage target. -->
<BuildProjectReferences Condition="'$(NoBuild)' == 'true'">false</BuildProjectReferences>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="Microsoft.Private.Intellisense" Version="[$(MicrosoftPrivateIntellisenseVersion)]" />
</ItemGroup>
<!--
============================================================
GetPackageContent
Selects all artifacts that we package for customers
============================================================
-->
<Target Name="GetPackageContent"
DependsOnTargets="SatelliteDllsProjectOutputGroup"
Returns="@(PackageFile)">
<PropertyGroup>
<RefPackagePath Condition="'$(RefPackagePath)' == ''">ref/$(TargetFramework)</RefPackagePath>
<IncludePdbInPackage Condition="'$(IncludePdbInPackage)' == '' AND '$(IsFacadeAssembly)' != 'true' AND '$(DebugType)' != 'embedded'">true</IncludePdbInPackage>
<IncludeResourcesInPackage>true</IncludeResourcesInPackage>
</PropertyGroup>
<!-- Analyzers and source generators -->
<PropertyGroup Condition="'$(IsAnalyzerProject)' == 'true'">
<_AnalyzerTargetLanguage>$(AssemblyName.Substring($(AssemblyName.LastIndexOf('.'))))</_AnalyzerTargetLanguage>
<AnalyzerTargetLanguage Condition="$(_AnalyzerTargetLanguage.Contains('.CSharp', StringComparison.OrdinalIgnoreCase))">/cs</AnalyzerTargetLanguage>
<AnalyzerTargetLanguage Condition="$(_AnalyzerTargetLanguage.Contains('.VisualBasic', StringComparison.OrdinalIgnoreCase))">/vb</AnalyzerTargetLanguage>
</PropertyGroup>
<PropertyGroup Condition="'$(PackagePath)' == ''">
<PackagePath>lib/$(TargetFramework)</PackagePath>
<PackagePath Condition="'$(IsFacadeAssembly)' == 'true'">lib/$(TargetFramework);$(RefPackagePath)</PackagePath>
<!-- Note that we are packaging analyzers not for consumption, but for transport purposes into dotnet/windowsdesktop -->
<PackagePath Condition="'$(IsAnalyzerProject)' == 'true'">sdk/analyzers/dotnet$(AnalyzerTargetLanguage)</PackagePath>
</PropertyGroup>
<PropertyGroup Condition="'$(HasNoPublicIntellisense)' != 'true'">
<!-- The intellisense provided by the Docs system -->
<IntellisenseXmlFileSource>$([MSBuild]::NormalizePath('$(_DotnetApiDocsFilesRoot)', '$(AssemblyName).xml'))</IntellisenseXmlFileSource>
<!-- Set the xml destination (for a later step that copies files from the $(_DotnetApiDocsPackageName) package to local build artifacts) -->
<IntellisenseXmlDest Condition="'$(ProduceReferenceAssembly)' == 'true' And '$(PackageAsRefAndLib)' != 'true'" >$([System.IO.Path]::ChangeExtension('$(TargetRefPath)', '.xml'))</IntellisenseXmlDest>
<IntellisenseXmlDest Condition="'$(PackageAsRefAndLib)' == 'true'" >$([System.IO.Path]::ChangeExtension('$(TargetPath)', '.xml'))</IntellisenseXmlDest>
<IntellisenseXmlDestDir Condition="'$(IntellisenseXmlDest)' != ''">$([System.IO.Path]::GetDirectoryName('$(IntellisenseXmlDest)'))</IntellisenseXmlDestDir>
</PropertyGroup>
<!--
If this file does NOT exist, and the assembly is NOT a facade assembly, this is an error.
This means we build a real assembly that has no associated official intellisense docs.
Contact the intellisense team for guidance.
-->
<Error Condition="!Exists('$(IntellisenseXmlFileSource)') and '$(IsFacadeAssembly)' != 'true' and '$(IsAnalyzerProject)' != 'true' and '$(HasNoPublicIntellisense)' != 'true'"
Text="$(AssemblyName).xml was not found in $(_DotnetApiDocsPackageName) package. Contact the intellisense team about adding the docs for this assembly."
/>
<ItemGroup>
<PackageFile Include="$(TargetPath)" PackagePath="$(PackagePath)" />
<PackageFile Condition="'$(IncludePdbInPackage)' == 'true'" Include="$(TargetDir)$(TargetName).pdb" PackagePath="$(PackagePath)" />
<PackageFile Condition="'$(ProduceReferenceAssembly)' == 'true'" Include="$(TargetRefPath)" PackagePath="$(RefPackagePath)" />
<PackageFile Condition="'$(ProduceReferenceAssembly)' == 'true' Or '$(PackageAsRefAndLib)' == 'true'"
Include="$(IntellisenseXmlFileSource)"
PackagePath="$(RefPackagePath)" />
<PackageFile Condition="'$(PackageAsRefAndLib)' == 'true'" Include="$(TargetPath)" PackagePath="$(RefPackagePath)" />
<PackageFile Condition="'$(IncludeResourcesInPackage)' == 'true'"
Include="@(SatelliteDllsProjectOutputGroupOutput->'%(FinalOutputPath)')"
PackagePath="$(PackagePath)/%(SatelliteDllsProjectOutputGroupOutput.Culture)" />
</ItemGroup>
</Target>
<!-- xml files can be added here for intellisense -->
<Target Name="CopyIntellisenseXmlsToTargetRefPath"
AfterTargets="Build"
Inputs="$(IntellisenseXmlFileSource)"
Outputs="$(IntellisenseXmlDest)"
Condition="'$(ProduceReferenceAssembly)' == 'true' Or '$(PackageAsRefAndLib)' == 'true'">
<Message Condition="!Exists('$(IntellisenseXmlFileSource)')"
Text="$(IntellisenseXmlFileSource) is missing" />
<MakeDir Condition="!Exists('$(IntellisenseXmlDestDir)')"
Directories="$([System.IO.Path]::GetDirectoryName('$(IntellisenseXmlDest)'))" />
<Copy SourceFiles="$(IntellisenseXmlFileSource)"
Condition="Exists('$(IntellisenseXmlFileSource)')"
DestinationFiles="$(IntellisenseXmlDest)"
SkipUnchangedFiles="true" />
</Target>
<!-- This is copied from runtime/eng/packaging.targets to allow adding additional project references to packages. -->
<Target Name="IncludeProjectReferencesWithPackAttributeInPackage"
Condition="'@(ProjectReference)' != '' and @(ProjectReference->AnyHaveMetadataValue('Pack', 'true'))"
DependsOnTargets="BuildOnlySettings;ResolveReferences">
<PropertyGroup>
<_referringTargetFramework>$(TargetFramework)</_referringTargetFramework>
<_referringTargetFramework Condition="'$(PackageUsePlatformTargeting)' != 'true' and $(TargetFramework.Contains('-'))">$(TargetFramework.SubString(0, $(TargetFramework.IndexOf('-'))))</_referringTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- Add ReferenceCopyLocalPaths for ProjectReferences which are flagged as Pack="true" into the package. -->
<_projectReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('Pack', 'true'))" />
<TfmSpecificPackageFile Include="@(_projectReferenceCopyLocalPaths)"
PackagePath="$([MSBuild]::ValueOrDefault('%(ReferenceCopyLocalPaths.PackagePath)', '$(BuildOutputTargetFolder)\$(_referringTargetFramework)\'))" />
<TfmSpecificDebugSymbolsFile Include="@(TfmSpecificPackageFile->WithMetadataValue('Extension', '.pdb'))"
TargetPath="/%(TfmSpecificPackageFile.PackagePath)/%(Filename)%(Extension)"
TargetFramework="$(_referringTargetFramework)"
Condition="'$(IncludeSymbols)' == 'true'" />
<!-- Remove symbol from the non symbol package. -->
<TfmSpecificPackageFile Remove="@(TfmSpecificPackageFile->WithMetadataValue('Extension', '.pdb'))" />
<!-- If the reference assembly is included, don't put the documentation file next to the lib assembly. -->
<TfmSpecificPackageFile Remove="@(_projectReferenceCopyLocalPaths->WithMetadataValue('Extension', '.xml')->WithMetadataValue('IncludeReferenceAssemblyInPackage', 'true'))" />
</ItemGroup>
<ItemGroup>
<!-- Include the reference assembly and put the documentation file next to it. -->
<_referenceAssemblyPaths Include="@(_projectReferenceCopyLocalPaths->WithMetadataValue('Extension', '.dll')->WithMetadataValue('IncludeReferenceAssemblyInPackage', 'true')->Metadata('ReferenceAssembly'))" />
<_referenceAssemblyPaths Include="@(_projectReferenceCopyLocalPaths->WithMetadataValue('Extension', '.xml')->WithMetadataValue('IncludeReferenceAssemblyInPackage', 'true'))" />
<TfmSpecificPackageFile Include="@(_referenceAssemblyPaths)"
PackagePath="ref\$(_referringTargetFramework)\" />
</ItemGroup>
</Target>
</Project>