Skip to content

Commit

Permalink
Change execution order conditions for intellisense swapping and copyi…
Browse files Browse the repository at this point in the history
…ng msbuild targets. (#83117)

* Change execution order conditions for intellisense swapping and copying msbuild targets.

* Don't change doc file when there isn't a intellisense one

---------

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
  • Loading branch information
carlossanlop and ViktorHofer authored Mar 16, 2023
1 parent 99aa25f commit 571fbb8
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions eng/intellisense.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
</PropertyGroup>

<Target Name="VerifyAssemblySupportsDocsXmlGeneration"
Condition="'$(UseIntellisensePackageDocXmlFile)' != 'true'">
<Error
Condition="'$(IsPartialFacadeAssembly)' == 'true'"
Text="The 'UseIntellisensePackageDocXmlFile' property is not supported for partial facade assemblies: $(AssemblyName)" />
<Error
Condition="'$(GeneratePlatformNotSupportedAssemblyMessage)' != ''"
Text="The 'UseIntellisensePackageDocXmlFile' property is not supported for assemblies that throw PlatformNotSupportedException: $(AssemblyName)" />
Condition="'$(UseIntellisensePackageDocXmlFile)' != 'true'">
<Error Text="The 'UseIntellisensePackageDocXmlFile' property is not supported for partial facade assemblies: $(AssemblyName)"
Condition="'$(IsPartialFacadeAssembly)' == 'true'" />
<Error Text="The 'UseIntellisensePackageDocXmlFile' property is not supported for assemblies that throw PlatformNotSupportedException: $(AssemblyName)"
Condition="'$(GeneratePlatformNotSupportedAssemblyMessage)' != ''" />
</Target>

<PropertyGroup>
<NoWarn Condition="'$(UseIntellisensePackageDocXmlFile)' == 'true'">$(NoWarn);1591</NoWarn>
<PropertyGroup Condition="'$(UseIntellisensePackageDocXmlFile)' == 'true'">
<NoWarn>$(NoWarn);1591</NoWarn>
<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="'$(UseIntellisensePackageDocXmlFile)' == 'true' and Exists($(IntellisensePackageXmlFilePathFromNetFolder))">$(IntellisensePackageXmlFilePathFromNetFolder)</IntellisensePackageXmlFilePath>
<IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and '$(UseIntellisensePackageDocXmlFile)' == 'true' and Exists($(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder))">$(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder)</IntellisensePackageXmlFilePath>
<IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromNetFolder))">$(IntellisensePackageXmlFilePathFromNetFolder)</IntellisensePackageXmlFilePath>
<IntellisensePackageXmlFilePath Condition="'$(IntellisensePackageXmlFilePath)' == '' and Exists($(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder))">$(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder)</IntellisensePackageXmlFilePath>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,22 +28,23 @@
<!-- TODO: Remove this target when no library relies on the intellisense documentation file anymore.-->
<!-- Replace the default xml file generated in the obj folder with the one that comes from the docs feed. -->
<Target Name="ChangeDocumentationFileForPackaging"
AfterTargets="DocumentationProjectOutputGroup"
Condition="'$(UseIntellisensePackageDocXmlFile)' == 'true'">
BeforeTargets="CopyFilesToOutputDirectory;DocumentationProjectOutputGroup"
Condition="'$(IntellisensePackageXmlFilePath)' != ''">
<ItemGroup>
<DocFileItem Remove="@(DocFileItem)" />
<DocFileItem Include="$(IntellisensePackageXmlFilePath)" />
</ItemGroup>
</Target>

<!-- Copy the intellisense file to the folder we use to produce the targeting pack.
The condition is for the RID agnostic build of source assemblies that are part of the .NET Core shared framework. -->
<Target Name="CopyDocumentationFileToXmlDocDir"
AfterTargets="CopyFilesToOutputDirectory"
Condition="'$(IsNetCoreAppSrc)' == 'true' and '$(TargetFramework)' == '$(NetCoreAppCurrent)'"
DependsOnTargets="ChangeDocumentationFileForPackaging">
Condition="'$(IsNetCoreAppSrc)' == 'true' and '$(TargetFramework)' == '$(NetCoreAppCurrent)'">
<Copy SourceFiles="@(DocFileItem)"
DestinationFolder="$(XmlDocDir)"
SkipUnchangedFiles="true"
UseHardlinksIfPossible="true" />
</Target>

</Project>
</Project>

0 comments on commit 571fbb8

Please sign in to comment.