Directory.Build.targets 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <Project>
  2. <!-- Properties which should be set after the project has been evaluated -->
  3. <PropertyGroup>
  4. <!--
  5. By default, all projects which produce packages are not intended to ship to NuGet.org as a product package.
  6. Packages which are intended to ship to NuGet.org must opt-in by setting this to true in the project file.
  7. -->
  8. <IsProductPackage Condition=" '$(IsProductPackage)' == '' ">false</IsProductPackage>
  9. <PackageOutputPath Condition=" '$(IsProductPackage)' == 'true' ">$(ProductPackageOutputPath)</PackageOutputPath>
  10. <PackageOutputPath Condition=" '$(IsProductPackage)' != 'true' ">$(InternalPackageOutputPath)</PackageOutputPath>
  11. </PropertyGroup>
  12. <PropertyGroup Condition=" '$(MSBuildProjectExtension)' == '.csproj' ">
  13. <PackageId Condition=" '$(PackageId)' == '' ">$(AssemblyName)</PackageId>
  14. <IsPackable Condition="'$(IsPackable)' == '' AND ( '$(IsTestProject)' == 'true' OR '$(IsTestAssetProject)' == 'true' OR '$(IsBenchmarkProject)' == 'true' OR '$(IsSampleProject)' == 'true' ) ">false</IsPackable>
  15. </PropertyGroup>
  16. <Import Project="eng\Baseline.Designer.props" />
  17. <PropertyGroup Condition=" '$(IsPackable)' != 'false' AND '$(AspNetCorePatchVersion)' != '0' ">
  18. <!-- Always include framework metapackages in patch updates. -->
  19. <IsPackageInThisPatch Condition="'$(IsFrameworkMetapackage)' == 'true' OR '$(IsSharedSourcePackage)' == 'true' ">true</IsPackageInThisPatch>
  20. <IsPackageInThisPatch Condition="'$(IsPackageInThisPatch)' == ''">$(PackagesInPatch.Contains(' $(PackageId);'))</IsPackageInThisPatch>
  21. </PropertyGroup>
  22. <PropertyGroup Condition=" '$(IsPackable)' != 'false' AND '$(IsServicingBuild)' == 'true' ">
  23. <!-- Used to distinguish between packages building -->
  24. <IsPackableInNonServicingBuild>true</IsPackableInNonServicingBuild>
  25. <!-- Suppress creation of .nupkg for servicing builds. -->
  26. <IsPackable Condition=" '$(IsPackageInThisPatch)' != 'true' ">false</IsPackable>
  27. </PropertyGroup>
  28. <PropertyGroup Condition=" '$(IsPackageInThisPatch)' != 'true' AND '$(BaselinePackageVersion)' != '' AND '$(IsServicingBuild)' == 'true' ">
  29. <!-- This keeps assembly and package versions consistent across patches. If a package is not included in a patch, its version should stay at the baseline. -->
  30. <AssemblyVersion>$(BaselinePackageVersion).0</AssemblyVersion>
  31. <!--
  32. Ideally, we would also set the project version to match the baseline in case NuGet turns a ProjectReference into a nuspec depenendency, but
  33. NuGet does not currently handle conflicts between packages and projects which have the same package id/version.
  34. See https://github.com/NuGet/Home/issues/6795.
  35. Because we still use static analysis to scrape versions, only set this during static analysis, which can be detected by checking for both NoBuild and DesignTimeBuild.
  36. -->
  37. <Version Condition="'$(NoBuild)' == 'true' AND '$(DesignTimeBuild)' == 'true'">$(BaselinePackageVersion)</Version>
  38. <PackageVersion Condition="'$(NoBuild)' == 'true' AND '$(DesignTimeBuild)' == 'true'">$(BaselinePackageVersion)</PackageVersion>
  39. </PropertyGroup>
  40. <PropertyGroup>
  41. <!-- Implementation projects are the projects which produce nuget packages or shipping assemblies. -->
  42. <IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND '$(IsTestAssetProject)' != 'true' AND '$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true' AND '$(IsSampleProject)' != 'true' ">true</IsImplementationProject>
  43. <!-- Suppress KoreBuild warnings about the mismatch of repo version and local project version. The versioning in this mega repo is sufficiently complicated that KoreBuild's validation isn't helpful. -->
  44. <VerifyVersion>false</VerifyVersion>
  45. <EnableApiCheck Condition=" '$(EnableApiCheck)' != '' ">$(IsImplementationProject)</EnableApiCheck>
  46. <IsPackable Condition="'$(IsPackable)' == '' AND '$(IsImplementationProject)' == 'true' ">true</IsPackable>
  47. <IsPackable Condition="'$(IsPackable)' == '' ">false</IsPackable>
  48. <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreApp30PackageVersion)</RuntimeFrameworkVersion>
  49. <NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
  50. </PropertyGroup>
  51. <Import Project="eng\targets\Cpp.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'" />
  52. <Import Project="eng\targets\CSharp.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
  53. <Import Project="eng\targets\Wix.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.wixproj'" />
  54. </Project>