Directory.Build.props 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <Project>
  2. <Import Project="eng\Common.props" />
  3. <PropertyGroup>
  4. <AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
  5. </PropertyGroup>
  6. <PropertyGroup>
  7. <!-- $(RepoRoot) is normally set globally and Arcade overrides it to ensure a trailing slash. -->
  8. <RepoRoot Condition=" '$(RepoRoot)' == '' OR !HasTrailingSlash('$(RepoRoot)') ">$(MSBuildThisFileDirectory)</RepoRoot>
  9. <RepositoryUrl>https://github.com/dotnet/aspnetcore</RepositoryUrl>
  10. <RepositoryType>git</RepositoryType>
  11. </PropertyGroup>
  12. <PropertyGroup>
  13. <EnableNETAnalyzers>true</EnableNETAnalyzers>
  14. <AnalysisLevel>latest</AnalysisLevel>
  15. <AnalysisMode>Default</AnalysisMode>
  16. </PropertyGroup>
  17. <!-- Defines project type conventions. -->
  18. <PropertyGroup>
  19. <RepoRelativeProjectDir>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</RepoRelativeProjectDir>
  20. <IsBenchmarkProject Condition=" $(MSBuildProjectName.EndsWith('.Performance')) OR
  21. $(RepoRelativeProjectDir.Contains('perf')) OR
  22. $(RepoRelativeProjectDir.Contains('benchmarkapps')) ">true</IsBenchmarkProject>
  23. <IsMicrobenchmarksProject Condition=" $(MSBuildProjectName.EndsWith('.Microbenchmarks')) ">true</IsMicrobenchmarksProject>
  24. <IsSpecificationTestProject Condition="$(MSBuildProjectName.EndsWith('.Specification.Tests'))">true</IsSpecificationTestProject>
  25. <IsUnitTestProject Condition=" '$(IsUnitTestProject)' == '' AND
  26. '$(IsSpecificationTestProject)' != 'true' AND
  27. ( $(MSBuildProjectName.EndsWith('Tests')) OR
  28. $(MSBuildProjectName.EndsWith('.Test')) OR
  29. $(MSBuildProjectName.EndsWith('.FunctionalTest')) ) ">true</IsUnitTestProject>
  30. <IsUnitTestProject Condition=" '$(IsUnitTestProject)' == '' ">false</IsUnitTestProject>
  31. <IsTrimmingTestProject Condition="$(MSBuildProjectName.EndsWith('.TrimmingTests'))">true</IsTrimmingTestProject>
  32. <IsNativeAotTestProject Condition="$(MSBuildProjectName.EndsWith('.NativeAotTests'))">true</IsNativeAotTestProject>
  33. <IsPublishedAppTestProject Condition="'$(IsTrimmingTestProject)' == 'true' or '$(IsNativeAotTestProject)' == 'true'">true</IsPublishedAppTestProject>
  34. <IsTestAssetProject Condition=" $(RepoRelativeProjectDir.Contains('testassets')) OR $(MSBuildProjectName.Contains('TestCommon'))">true</IsTestAssetProject>
  35. <IsProjectTemplateProject Condition=" ($(RepoRelativeProjectDir.Contains('ProjectTemplates')) OR $(MSBuildProjectName.Contains('ProjectTemplates')) ) AND
  36. '$(IsUnitTestProject)' != 'true' AND
  37. '$(IsTestAssetProject)' != 'true' ">true</IsProjectTemplateProject>
  38. <IsSampleProject Condition=" $(RepoRelativeProjectDir.ToUpperInvariant().Contains('SAMPLE')) ">true</IsSampleProject>
  39. <IsAnalyzersProject Condition="$(MSBuildProjectName.EndsWith('.Analyzers'))">true</IsAnalyzersProject>
  40. <IsShipping Condition=" '$(IsSampleProject)' == 'true' OR
  41. '$(IsTestAssetProject)' == 'true' OR
  42. '$(IsBenchmarkProject)' == 'true' OR
  43. '$(IsPublishedAppTestProject)' == 'true' OR
  44. $(IsUnitTestProject) ">false</IsShipping>
  45. <!--
  46. Following logic mimics core-setup approach as well as
  47. https://github.com/dotnet/arcade/blob/694d59f090b743f894779d04a7ffe11cbaf352e7/src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj#L30-L31
  48. $(DotNetFinalVersionKind) is set globally when doing final aka stable builds. Arcade infrastructure should pick
  49. up $(IsStableBuild) automatically; property is also used to control prerelease branding.
  50. -->
  51. <IsStableBuild>false</IsStableBuild>
  52. <IsStableBuild Condition=" '$(DotNetFinalVersionKind)' == 'release' ">true</IsStableBuild>
  53. </PropertyGroup>
  54. <!-- Disable logging of some task parameters or metadata to reduce binlog size.
  55. Reenable logging of any particular item by changing the value of the property below to 'false'
  56. The format is as follows:
  57. DisableLogTaskParameter_[task name]_[parameter name] - Disable logging of a particular parameter
  58. DisableLogTaskParameterItemMetadata_[task name]_[parameter name] - Disable logging of item metadata of the parameter
  59. -->
  60. <PropertyGroup>
  61. <TrimTaskParameters Condition=" '$(TrimTaskParameters)' == '' ">true</TrimTaskParameters>
  62. <!-- ItemsToHash is used for incremental building and hashes input properties to a file
  63. This is not generally useful for day-to-day build debugging. -->
  64. <DisableLogTaskParameter_Hash_ItemsToHash>$(TrimTaskParameters)</DisableLogTaskParameter_Hash_ItemsToHash>
  65. <!-- JoinItems takes input ItemGroups. The output ItemGroup is logged. -->
  66. <DisableLogTaskParameter_JoinItems_Right>$(TrimTaskParameters)</DisableLogTaskParameter_JoinItems_Right>
  67. <DisableLogTaskParameter_JoinItems_Left>$(TrimTaskParameters)</DisableLogTaskParameter_JoinItems_Left>
  68. <!-- ConvertToAbsolutePaths - The output parameter (AbsolutePaths) is interesting
  69. while the input Path is not generally useful. The output itemgroup's metadata
  70. is not altered by the task. -->
  71. <DisableLogTaskParameter_ConvertToAbsolutePath_Paths>$(TrimTaskParameters)</DisableLogTaskParameter_ConvertToAbsolutePath_Paths>
  72. <DisableLogTaskParameterItemMetadata_ConvertToAbsolutePath_Paths>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_ConvertToAbsolutePath_Paths>
  73. <!-- The standard msbuild Copy task does not use Metadata and thus the input/outputs
  74. item metadata is not relevant -->
  75. <DisableLogTaskParameterItemMetadata_Copy_SourceFiles>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_Copy_SourceFiles>
  76. <DisableLogTaskParameterItemMetadata_Copy_DestinationFiles>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_Copy_DestinationFiles>
  77. <!-- Reference metadata for GenerateDepsFile, Csc, RAR, etc. are sometimes useful, but extraordinarily large
  78. when building against a shared framework where the number of input assemblies is very large.
  79. Avoid logging these by default. -->
  80. <DisableLogTaskParameterItemMetadata_GenerateDepsFile_ReferenceAssemblies>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_GenerateDepsFile_ReferenceAssemblies>
  81. <DisableLogTaskParameterItemMetadata_GenerateDepsFile_ReferencePaths>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_GenerateDepsFile_ReferencePaths>
  82. <DisableLogTaskParameterItemMetadata_ResolveAssemblyReference_Assemblies>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_ResolveAssemblyReference_Assemblies>
  83. <DisableLogTaskParameterItemMetadata_Csc_References>$(TrimTaskParameters)</DisableLogTaskParameterItemMetadata_Csc_References>
  84. </PropertyGroup>
  85. <Import Project="eng\QuarantinedTests.BeforeArcade.props" />
  86. <Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
  87. <Import Project="eng\QuarantinedTests.AfterArcade.props" />
  88. <PropertyGroup>
  89. <Product>Microsoft ASP.NET Core</Product>
  90. <StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
  91. <!-- The SPDX name for the source license. See https://spdx.org/licenses/. -->
  92. <PackageLicenseExpression>MIT</PackageLicenseExpression>
  93. <!-- Contact email address for NuGet packages and Linux installers. -->
  94. <MaintainerEmail>nugetaspnet@microsoft.com</MaintainerEmail>
  95. <PackageProjectUrl>https://asp.net</PackageProjectUrl>
  96. <NuspecBasePath>$(MSBuildProjectDirectory)</NuspecBasePath>
  97. <IncludeSymbols>true</IncludeSymbols>
  98. <DefaultNetFxTargetFramework>net462</DefaultNetFxTargetFramework>
  99. </PropertyGroup>
  100. <!-- Warnings and errors -->
  101. <PropertyGroup>
  102. <!-- Ensure API docs are available. -->
  103. <NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
  104. <NoWarn Condition=" '$(BuildingInsideVisualStudio)' == 'true' ">$(NoWarn);0105</NoWarn>
  105. <!-- Allow prerelease dependencies in stable packages when we're running the IdentityModel nightly tests -->
  106. <NoWarn Condition=" '$(IsIdentityModelTestJob)' == 'true' ">$(NoWarn);NU5104</NoWarn>
  107. <!-- For local builds, don't make missing XML docs a fatal build error, but still surface so we have visibility into undocumented APIs. -->
  108. <WarningsNotAsErrors Condition=" '$(ContinuousIntegrationBuild)' != 'true' ">$(WarningsNotAsErrors);CS1591</WarningsNotAsErrors>
  109. <!-- xUnit1004 = warns about skipped tests. Make this a non-fatal build warning. -->
  110. <WarningsNotAsErrors>$(WarningsNotAsErrors);xUnit1004</WarningsNotAsErrors>
  111. <!-- don't warn about unnecessary trim warning suppressions. can be removed with preview 6. -->
  112. <NoWarn>$(NoWarn);IL2121</NoWarn>
  113. <!-- // Temporary diagnostic code from https://github.com/dotnet/extensions/pull/4130 for metrics APIs used in test. -->
  114. <NoWarn>$(NoWarn);TBD</NoWarn>
  115. </PropertyGroup>
  116. <!-- Source code settings -->
  117. <PropertyGroup>
  118. <SharedSourceRoot>$(MSBuildThisFileDirectory)src\Shared\</SharedSourceRoot>
  119. <GoogleTestSubmoduleRoot>$(RepoRoot)src\submodules\googletest\</GoogleTestSubmoduleRoot>
  120. <!-- Embed source files that are not tracked by the source control manager in the PDB. -->
  121. <EmbedUntrackedSources>true</EmbedUntrackedSources>
  122. </PropertyGroup>
  123. <PropertyGroup>
  124. <SharedFxName>Microsoft.AspNetCore.App</SharedFxName>
  125. <SharedFxDescription>Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub ($(RepositoryUrl)). We happily accept issues and PRs.</SharedFxDescription>
  126. <NETCoreAppFrameworkIdentifier>.NETCoreApp</NETCoreAppFrameworkIdentifier>
  127. <NETCoreAppFramework>netcoreapp$(AspNetCoreMajorMinorVersion)</NETCoreAppFramework>
  128. <AspNetCoreAppFrameworkBrandName>ASP.NET Core $(AspNetCoreMajorMinorVersion)</AspNetCoreAppFrameworkBrandName>
  129. <TargetingPackName>Microsoft.AspNetCore.App.Ref</TargetingPackName>
  130. <RuntimeInstallerBaseName>aspnetcore-runtime</RuntimeInstallerBaseName>
  131. <TargetingPackInstallerBaseName>aspnetcore-targeting-pack</TargetingPackInstallerBaseName>
  132. </PropertyGroup>
  133. <!-- Compilation options which apply to all languages. Language-specific options should be set in eng/targets/$(lang).Common.props -->
  134. <PropertyGroup>
  135. <BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture>
  136. <!-- This defines the list of RIDs supported by the ASP.NET Core shared framework.
  137. The list is a semicolon separated list of RIDs. Whitespace may not be added to the property. -->
  138. <SupportedRuntimeIdentifiers>win-x64;win-x86;win-arm;win-arm64;osx-x64;osx-arm64;linux-musl-x64;linux-musl-arm;linux-musl-arm64;linux-x64;linux-arm;linux-arm64;freebsd-x64</SupportedRuntimeIdentifiers>
  139. <SupportedRuntimeIdentifiers Condition=" '$(DotNetBuildSourceOnly)' == 'true' ">$(SupportedRuntimeIdentifiers);$(TargetRuntimeIdentifier)</SupportedRuntimeIdentifiers>
  140. <!-- Playwright provides binaries for Windows (x86 and x64), macOS (x64) and Linux (x64, non musl). We can't use it on other architectures. -->
  141. <IsPlaywrightAvailable Condition="'$(TargetOsName)' == 'linux-musl' OR ('$(TargetArchitecture)' != 'x86' AND '$(TargetArchitecture)' != 'x64')">false</IsPlaywrightAvailable>
  142. <IsPlaywrightAvailable Condition="'$(IsPlaywrightAvailable)' == ''">true</IsPlaywrightAvailable>
  143. <!-- Make error messages clickable in VS Code's console -->
  144. <GenerateFullPaths Condition="'$(VSCODE_CWD)' != '' OR '$(TERM_PROGRAM)' == 'vscode'">true</GenerateFullPaths>
  145. <!-- Fixes a common error in targets implementing a NoBuild mode. -->
  146. <BuildProjectReferences Condition=" '$(NoBuild)' == 'true' ">false</BuildProjectReferences>
  147. </PropertyGroup>
  148. <!-- Artifacts layout. Keep these values consistent with items defined in eng/Publishing.props. -->
  149. <PropertyGroup>
  150. <InstallersOutputPath>$(ArtifactsDir)installers\$(Configuration)\</InstallersOutputPath>
  151. <SymbolsOutputPath>$(ArtifactsDir)symbols\$(Configuration)\</SymbolsOutputPath>
  152. </PropertyGroup>
  153. <!-- Ensure these output paths exist. -->
  154. <ItemGroup>
  155. <CreateDirectory Include="$(InstallersOutputPath)" />
  156. <CreateDirectory Include="$(VisualStudioSetupOutputPath)" />
  157. </ItemGroup>
  158. <!-- The location of the local installation of the .NET Core shared framework. -->
  159. <PropertyGroup>
  160. <LocalDotNetRoot>$(RepoRoot).dotnet\</LocalDotNetRoot>
  161. <LocalDotNetRoot Condition="'$(DotNetBuild)' == 'true'">DontDareMutateThisSDK</LocalDotNetRoot>
  162. <!--
  163. Override the SDK default and point to local .dotnet folder. This is done to work around
  164. limitations in the way the .NET SDK finds shared frameworks and targeting packs. It allows
  165. tests to use the shared frameworks and targeting packs that were just built.
  166. However, source-build needs this to not happen while building projects that rely on the
  167. AppHost framework pack. Source-build installs an SDK in a custom location outside this
  168. repository, and setting NetCoreTargetingPackRoot to a different location causes source-build
  169. to restore the AppHost pack as a prebuilt rather than using the one that's present in the SDK.
  170. Source-build doesn't run tests, so the property is simply conditioned out.
  171. -->
  172. <NetCoreTargetingPackRoot Condition="'$(DotNetBuild)' != 'true'">$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
  173. <!-- This is not correct and needs attention eventually. This is primarily used to find the nethost headers in the apphost pack.
  174. These should be coming from a restored apphost pack, rather than a hard-coded local SDK. In fact, aspnetcore
  175. should not rely on a local SDK or mutating one to build. -->
  176. <NetCoreTargetingPackRoot Condition="'$(DotNetBuild)' == 'true'">$(DotNetRoot)packs\</NetCoreTargetingPackRoot>
  177. </PropertyGroup>
  178. <Import Project="eng\tools\RepoTasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />
  179. <PropertyGroup>
  180. <!--
  181. Disable deterministic source paths in test assets and samples.
  182. In order for the debugger to find source files when debugging a locally built binary the PDB must contain original, unmapped local paths
  183. -->
  184. <DeterministicSourcePaths Condition="'$(IsSampleProject)' == 'true' OR '$(IsTestAssetProject)' == 'true'">false</DeterministicSourcePaths>
  185. <!-- Projects which reference Microsoft.AspNetCore.Mvc.Testing should import this targets file to ensure dependency .deps.json files are copied into test output. -->
  186. <MvcTestingTargets>$(MSBuildThisFileDirectory)src\Mvc\Mvc.Testing\src\Microsoft.AspNetCore.Mvc.Testing.targets</MvcTestingTargets>
  187. <_MvcTestingTasksAssembly>$(ArtifactsBinDir)\Microsoft.AspNetCore.Mvc.Testing.Tasks\$(Configuration)\netstandard2.0\Microsoft.AspNetCore.Mvc.Testing.Tasks.dll</_MvcTestingTasksAssembly>
  188. <!-- IIS native projects can only be built on Windows for x86/x64/ARM64. -->
  189. <UseIisNativeAssets Condition=" '$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64' OR '$(TargetArchitecture)' == 'ARM64') ">true</UseIisNativeAssets>
  190. <!-- This property is shared by several projects to layout the AspNetCore.App targeting pack for installers -->
  191. <TargetingPackLayoutRoot>$(ArtifactsObjDir)TargetingPack.Layout\$(Configuration)\</TargetingPackLayoutRoot>
  192. <!-- This property is shared by several projects to layout the AspNetCore.App shared framework for installers -->
  193. <SharedFrameworkLayoutRoot>$(ArtifactsObjDir)SharedFx.Layout\$(Configuration)\$(TargetRuntimeIdentifier)\</SharedFrameworkLayoutRoot>
  194. <!-- This property points to a folder which includes both Microsoft.NETCore.App and AspNetCore.App. -->
  195. <RedistSharedFrameworkLayoutRoot>$(ArtifactsObjDir)RedistSharedFx.Layout\$(Configuration)\$(TargetRuntimeIdentifier)\</RedistSharedFrameworkLayoutRoot>
  196. <ArchiveExtension>.tar.gz</ArchiveExtension>
  197. <ArchiveExtension Condition="'$(TargetOsName)' == 'win'">.zip</ArchiveExtension>
  198. </PropertyGroup>
  199. <PropertyGroup>
  200. <!-- Set the arcade before common targets so we compute ExcludeFromBuild before arcade uses it. -->
  201. <CustomBeforeMicrosoftCommonTargets>$(MSBuildThisFileDirectory)Directory.Build.BeforeCommonTargets.targets</CustomBeforeMicrosoftCommonTargets>
  202. <CustomBeforeMicrosoftCommonCrossTargetingTargets>$(MSBuildThisFileDirectory)Directory.Build.BeforeCommonTargets.targets</CustomBeforeMicrosoftCommonCrossTargetingTargets>
  203. </PropertyGroup>
  204. <Import Project="eng\Workarounds.props" />
  205. <Import Project="artifacts\bin\GenerateFiles\Directory.Build.props" Condition=" '$(MSBuildProjectName)' != 'GenerateFiles' " />
  206. <Import Project="eng\Dependencies.props" />
  207. <Import Project="eng\ProjectReferences.props" />
  208. <Import Project="eng\RequiresDelayedBuildProjects.props" />
  209. <Import Project="eng\SharedFramework.Local.props" />
  210. <Import Project="eng\SharedFramework.External.props" />
  211. <Import Project="eng\ShippingAssemblies.props" />
  212. <Import Project="eng\targets\Cpp.Common.props" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'" />
  213. <Import Project="eng\targets\CSharp.Common.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
  214. <Import Project="eng\targets\Wix.Common.props" Condition="'$(MSBuildProjectExtension)' == '.wixproj'" />
  215. <Import Project="eng\targets\Java.Common.props" Condition="'$(MSBuildProjectExtension)' == '.javaproj'" />
  216. <Import Project="eng\testing\linker\trimmingTests.props" Condition="'$(IsPublishedAppTestProject)' == 'true'" />
  217. <Import Project="eng\targets\Helix.props" Condition=" $(IsTestProject) " />
  218. <Import Project="eng\targets\FunctionalTestWithAssets.props" Condition=" $(IsTestProject) " />
  219. <!-- Keys used by InternalsVisibleTo attributes. -->
  220. <PropertyGroup>
  221. <MoqPublicKey>0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7</MoqPublicKey>
  222. </PropertyGroup>
  223. </Project>