Directory.Build.targets 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. <IsShippingPackage Condition=" '$(IsShippingPackage)' == '' ">false</IsShippingPackage>
  9. <PackageOutputPath Condition=" '$(IsShippingPackage)' == 'true' ">$(ArtifactsShippingPackagesDir)</PackageOutputPath>
  10. <PackageOutputPath Condition=" '$(IsShippingPackage)' != 'true' ">$(ArtifactsNonShippingPackagesDir)</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. <IsPackageInThisPatch Condition="'$(IsPackageInThisPatch)' == ''">$(PackagesInPatch.Contains(' $(PackageId);'))</IsPackageInThisPatch>
  19. </PropertyGroup>
  20. <PropertyGroup Condition=" '$(IsPackable)' != 'false' AND '$(IsServicingBuild)' == 'true' ">
  21. <!-- Used to distinguish between packages building -->
  22. <IsPackableInNonServicingBuild>true</IsPackableInNonServicingBuild>
  23. <!-- Suppress creation of .nupkg for servicing builds. -->
  24. <IsPackable Condition=" '$(IsPackageInThisPatch)' != 'true' ">false</IsPackable>
  25. </PropertyGroup>
  26. <PropertyGroup Condition=" '$(IsPackageInThisPatch)' != 'true' AND '$(BaselinePackageVersion)' != '' AND '$(IsServicingBuild)' == 'true' ">
  27. <!-- 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. -->
  28. <AssemblyVersion Condition="$(BaselinePackageVersion.Contains('-'))">$(BaselinePackageVersion.Substring(0, $(BaselinePackageVersion.IndexOf('-')))).0</AssemblyVersion>
  29. <AssemblyVersion Condition="! $(BaselinePackageVersion.Contains('-'))">$(BaselinePackageVersion).0</AssemblyVersion>
  30. <!--
  31. Ideally, we would also set the project version to match the baseline in case NuGet turns a ProjectReference into a nuspec depenendency, but
  32. NuGet does not currently handle conflicts between packages and projects which have the same package id/version.
  33. See https://github.com/NuGet/Home/issues/6795.
  34. 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.
  35. -->
  36. <Version Condition="'$(NoBuild)' == 'true' AND '$(DesignTimeBuild)' == 'true'">$(BaselinePackageVersion)</Version>
  37. <PackageVersion Condition="'$(NoBuild)' == 'true' AND '$(DesignTimeBuild)' == 'true'">$(BaselinePackageVersion)</PackageVersion>
  38. </PropertyGroup>
  39. <PropertyGroup>
  40. <!-- Implementation projects are the projects which produce nuget packages or shipping assemblies. -->
  41. <IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND '$(IsTestAssetProject)' != 'true' AND '$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true' AND '$(IsSampleProject)' != 'true' ">true</IsImplementationProject>
  42. <!-- This determines whether a project is available as a <Reference> to other projects in this repo. -->
  43. <IsProjectReferenceProvider Condition=" '$(IsProjectReferenceProvider)' == '' AND '$(IsImplementationProject)' == 'true' AND '$(PackAsTool)' != 'true' ">true</IsProjectReferenceProvider>
  44. <!-- 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. -->
  45. <VerifyVersion>false</VerifyVersion>
  46. <EnableApiCheck Condition=" '$(EnableApiCheck)' != '' ">$(IsImplementationProject)</EnableApiCheck>
  47. <IsPackable Condition="'$(IsPackable)' == '' AND '$(IsImplementationProject)' == 'true' ">true</IsPackable>
  48. <IsPackable Condition="'$(IsPackable)' == '' ">false</IsPackable>
  49. <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
  50. </PropertyGroup>
  51. <Import Project="eng\targets\ResolveIisReferences.targets" Condition=" '$(MSBuildProjectExtension)' != '.vcxproj' " />
  52. <Import Project="eng\targets\Cpp.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'" />
  53. <Import Project="eng\targets\CSharp.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
  54. <Import Project="eng\targets\FSharp.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.fsproj'" />
  55. <Import Project="eng\targets\Wix.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.wixproj'" />
  56. <Import Project="eng\targets\Npm.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.npmproj'" />
  57. </Project>