-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
Copy pathintellisense.targets
76 lines (64 loc) · 5.17 KB
/
intellisense.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<Project>
<PropertyGroup>
<UseCompilerGeneratedDocXmlFile Condition="'$(UseCompilerGeneratedDocXmlFile)' == ''">true</UseCompilerGeneratedDocXmlFile>
</PropertyGroup>
<PropertyGroup Condition="'$(UseCompilerGeneratedDocXmlFile)' != 'true'">
<IntellisensePackageXmlRootFolder>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.private.intellisense', '$(MicrosoftPrivateIntellisenseVersion)', 'IntellisenseFiles'))</IntellisensePackageXmlRootFolder>
<IntellisensePackageXmlFilePathFromNetFolder>$([MSBuild]::NormalizePath('$(IntellisensePackageXmlRootFolder)', 'net', '1033', '$(AssemblyName).xml'))</IntellisensePackageXmlFilePathFromNetFolder>
<IntellisensePackageXmlFilePathFromDotNetPlatExtFolder>$([MSBuild]::NormalizePath('$(IntellisensePackageXmlRootFolder)', 'dotnet-plat-ext', '1033', '$(AssemblyName).xml'))</IntellisensePackageXmlFilePathFromDotNetPlatExtFolder>
<IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromNetFolder))">$(IntellisensePackageXmlFilePathFromNetFolder)</IntellisensePackageXmlFilePath>
<IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder))">$(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder)</IntellisensePackageXmlFilePath>
<IntermediateDocFileItemFromIntellisensePackage>$([MSBuild]::NormalizePath('$(IntermediateOutputPath)', 'intellisense-package', '$(TargetName).xml'))</IntermediateDocFileItemFromIntellisensePackage>
<!-- Suppress "CS1591 - Missing XML comment for publicly visible type or member" compiler errors when the intellisense package xml file is used. -->
<NoWarn Condition="'$(SkipIntellisenseNoWarnCS1591)' != 'true'">$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<!-- Flow these properties to consuming projects for Microsoft.Internal.Runtime.DotNetApiDocs.Transport.proj to only
include the source of truth compiler generated documentation files. -->
<ItemDefinitionGroup>
<TargetPathWithTargetPlatformMoniker>
<UseCompilerGeneratedDocXmlFile>$(UseCompilerGeneratedDocXmlFile)</UseCompilerGeneratedDocXmlFile>
<IsPartialFacadeAssembly>$(IsPartialFacadeAssembly)</IsPartialFacadeAssembly>
<IsPlatformNotSupportedAssembly Condition="'$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">true</IsPlatformNotSupportedAssembly>
<SuppressPlatformNotSupportedAssemblyDocXmlError>$(SuppressPlatformNotSupportedAssemblyDocXmlError)</SuppressPlatformNotSupportedAssemblyDocXmlError>
</TargetPathWithTargetPlatformMoniker>
</ItemDefinitionGroup>
<ItemGroup>
<PackageDownload Include="Microsoft.Private.Intellisense" Version="[$(MicrosoftPrivateIntellisenseVersion)]" />
</ItemGroup>
<!-- Warn if the docs team provided package doesn't have an intellisense file for a given library and the library explicitly
opts out from using the compiler generated xml file. -->
<Target Name="ValidateIntellisensePackageXmlFilePathExists"
Condition="'$(UseCompilerGeneratedDocXmlFile)' != 'true' and
'$(IntellisensePackageXmlFilePath)' == ''"
BeforeTargets="CoreCompile">
<Warning Text="The 'UseCompilerGeneratedDocXmlFile' property was set to '$(UseCompilerGeneratedDocXmlFile)', but the doc team doesn't provide a file for this assembly. Remove the 'UseCompilerGeneratedDocXmlFile' property to let the compiler generate the file." />
</Target>
<!-- Prepare the intellisense package xml file by copying it to the project's intermediate folder and update its file timestamp.
This is necessary so that all project outputs are newer than all project inputs. Directly copying from the intellisense package
would violate that and break fast up-to-date check. -->
<Target Name="PrepareIntellisensePackageXmlFile"
Inputs="$(IntellisensePackageXmlFilePath)"
Outputs="$(IntermediateDocFileItemFromIntellisensePackage)">
<Copy SourceFiles="$(IntellisensePackageXmlFilePath)"
DestinationFiles="$(IntermediateDocFileItemFromIntellisensePackage)" />
<Touch Files="$(IntermediateDocFileItemFromIntellisensePackage)" />
</Target>
<!-- Replace the compiler generated xml file in the obj folder with the one that comes from the intellisense package. -->
<Target Name="ChangeDocumentationFileForPackaging"
DependsOnTargets="PrepareIntellisensePackageXmlFile"
BeforeTargets="CopyFilesToOutputDirectory;DocumentationProjectOutputGroup"
Condition="'$(UseCompilerGeneratedDocXmlFile)' != 'true' and '$(IntellisensePackageXmlFilePath)' != ''">
<ItemGroup>
<DocFileItem Remove="@(DocFileItem)" />
<DocFileItem Include="$(IntermediateDocFileItemFromIntellisensePackage)" />
</ItemGroup>
</Target>
<!-- Allow P2Ps to retrieve the DocFileItem path. -->
<Target Name="AnnotateTargetPathWithTargetPlatformMonikerWithDocFileItem"
DependsOnTargets="ChangeDocumentationFileForPackaging;GetTargetPathWithTargetPlatformMoniker"
BeforeTargets="GetTargetPath">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker DocFileItem="@(DocFileItem)" />
</ItemGroup>
</Target>
</Project>