File: C\Users\cloudtest\.nuget\packages\microsoft.dotnet.arcade.sdk\9.0.0-beta.24466.2\tools\ExcludeFromBuild.BeforeCommonTargets.targets
Project: ..\..\..\src\Package\DevDivPackage\DevDivPackage.csproj (MSBuildFiles)
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
 
  <!--  This file sets properties that enable skipping of a project build if desired.
        Cases where we might skip include:
        - Source-build mode and "ExcludeFromSourceBuild" is set.
        - Non source-build mode and "ExcludeFromBuild" is set
        - Target filtering is used and the target filters set "ExcludeFromBuild".
        - .NET product build (DotNetBuild) and "ExcludeFromDotNetBuild" is set.
        - .NET product build in source-only mode and "ExcludeFromSourceOnlyBuild" is set.
 
        To exclude a project from building, Arcade must do two things:
        - Create/override the standard targets (Build, Restore, Sign, etc.) with empty ones.
        - Keep the .NET SDK from importing the standard NuGet restore targets - NuGet uses the
          '_IsProjectRestoreSupported target' to determine whether a project can be restored. If the project shouldn't be built,
          it shouldn't be restored either. This could be done two ways:
            - Override the _IsProjectRestoreSupported target to an empty target, or one that returns false.
            - Avoid import of the _IsProjectRestoreSupported target altogether.
          The first approach is more consistent with the rest of Arcade's approach to skipping a build.
          However is does **not** work with msbuild static graph. Static graph uses the *existence* of the
          target to determine whether a project should be restored, so overriding with an empty target will
          only avoid building a project, but it will still get restored. This could cause issues with target
          framework filtering, or introduce unexpected prebuilts.
 
          So to achieve the desired affect, Arcade must reset NuGetRestoreTargets to an empty file. Because
          this import is done early, the BeforeCommonTargets hook must be used. There is a case
          where the BeforeCommonTargets hook is not used (see https://github.com/dotnet/arcade/issues/2676).
          In that case, Sdk.targets imports it explicitly. -->
 
  <!-- Exclude test and test utility projects from source-only and .NET non-source only product builds by default. -->
  <PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestUtilityProject)' == 'true'">
    <ExcludeFromSourceOnlyBuild Condition="'$(ExcludeFromSourceOnlyBuild)' == '' and '$(DotNetBuildTests)' != 'true'">true</ExcludeFromSourceOnlyBuild>
    <ExcludeFromSourceBuild Condition="'$(ExcludeFromSourceBuild)' == '' and '$(DotNetBuildTests)' != 'true'">true</ExcludeFromSourceBuild>
 
    <ExcludeFromDotNetBuild Condition="'$(ExcludeFromDotNetBuild)' == '' and '$(DotNetBuildTests)' != 'true'">true</ExcludeFromDotNetBuild>
  </PropertyGroup>
 
  <!--
    Calculate the value of the target suppress flag. It should be true when:
    - Building from source only and the project is excluded from source-only builds (legacy switches and new switches)
    - Building a vertical and the project is excluded from vertical builds (to be removed)
    - The project is explicitly excluded.
 
    It's also possible to set ExcludeFromBuild prior to importing the Sdk.targets
    to skip building as desired in non-source build scenarios. This might be done to
    avoid building tests in certain product build scenarios.
  -->
  <PropertyGroup>
    <_SuppressAllTargets>false</_SuppressAllTargets>
    <!-- Legacy switches-->
    <_SuppressAllTargets Condition="'$(DotNetBuildFromSource)' == 'true' and '$(ExcludeFromSourceBuild)' == 'true'">true</_SuppressAllTargets>
    <!-- New .NET build switches -->
    <_SuppressAllTargets Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(ExcludeFromSourceOnlyBuild)' == 'true'">true</_SuppressAllTargets>
    <_SuppressAllTargets Condition="'$(DotNetBuild)' == 'true' and '$(ExcludeFromDotNetBuild)' == 'true'">true</_SuppressAllTargets>
    <!-- General exclusion -->
    <_SuppressAllTargets Condition="'$(ExcludeFromBuild)' == 'true'">true</_SuppressAllTargets>
 
    <!-- If excluding, then disable a restore warning, which will fire on newer SDKs, as well as set the NuGetRestoreTargets property to empty,
         which will avoid importing the restore targets inside the .NET SDK. If the restore targets exist, then static graph restore will attempt tpo
         execute. -->
    <DisableWarnForInvalidRestoreProjects Condition="'$(_SuppressAllTargets)' == 'true'">true</DisableWarnForInvalidRestoreProjects>
    <NuGetRestoreTargets Condition="'$(_SuppressAllTargets)' == 'true'">$(MSBuildThisFileDirectory)NoRestore.targets</NuGetRestoreTargets>
    <!-- When a project is using the .NET SDK, but with the "UseWpf" property, there will be an attempt to import the windows desktop SDK targets.
         These are not available in certain circumstances, like linux source build. -->
    <ImportWindowsDesktopTargets Condition="'$(_SuppressAllTargets)' == 'true'">false</ImportWindowsDesktopTargets>
  </PropertyGroup>
 
</Project>