Files
mcp-microsoft/Directory.Build.props
T
Anu Thomas fb03e082a0 Do not define ENABLE_HTTP build property for native build (#1071)
Define ENABLE_REMOTE build property for native build
2025-11-05 10:55:11 -08:00

67 lines
3.2 KiB
XML

<Project>
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>False</IsPackable>
<TrimMode>full</TrimMode>
<!-- Suppress SYSLIB0020 for generated System.Text.Json code that uses obsolete IgnoreNullValues -->
<NoWarn>$(NoWarn);SYSLIB0020</NoWarn>
<BuildNative Condition="'$(BuildNative)' == ''">false</BuildNative>
<!-- Identify Server Projects -->
<_RelativeProjectDir>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)').Replace($([System.IO.Path]::GetFullPath('$(RepoRoot)')), ''))</_RelativeProjectDir>
<IsServerProject Condition="'$(IsServerProject)' == '' and $(_RelativeProjectDir.StartsWith('servers')) and $(_RelativeProjectDir.EndsWith('src'))">true</IsServerProject>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildNative)' == 'true'">
<DefineConstants>$(DefineConstants);BUILD_NATIVE</DefineConstants>
</PropertyGroup>
<!-- HTTP transport is unsupported for native and trimmed variants. ENABLE_HTTP is not set for these build variants.
See https://github.com/AzureAD/microsoft-identity-web/issues/3576 -->
<PropertyGroup Condition="'$(PublishTrimmed)' != 'true' and '$(BuildNative)' != 'true'">
<DefineConstants>$(DefineConstants);ENABLE_HTTP</DefineConstants>
</PropertyGroup>
<!-- Windows AOT native build security flags to enable 'Control Flow Guard' (CFG) -->
<PropertyGroup Condition="'$(BuildNative)' == 'true' and $(RuntimeIdentifier.StartsWith('win'))">
<ControlFlowGuard>Guard</ControlFlowGuard>
</PropertyGroup>
<PropertyGroup Condition="'$(IsServerProject)' == 'true'">
<!-- .NET Tool Package settings -->
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
<PackageType>McpServer</PackageType>
<PackageIcon>$(RepoRoot)eng/images/microsofticon.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Keep these aligned with OS + arch build-matrix.json. -->
<RuntimeIdentifiers>win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<CopyOutputSymbolsToPublishDirectory>true</CopyOutputSymbolsToPublishDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(IsServerProject)' == 'true' and '$(RuntimeIdentifier)' == ''">
<McpServerJsonTemplateFile>$(RepoRoot)eng/dnx/.mcp/server.json</McpServerJsonTemplateFile>
</PropertyGroup>
<PropertyGroup Condition="'$(IsServerProject)' == 'true' and '$(BuildNative)' == 'true'">
<!-- AOT native build flags -->
<IsAotCompatible>true</IsAotCompatible>
<PublishAot>true</PublishAot>
<IlcOptimizationPreference>Size</IlcOptimizationPreference>
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
</PropertyGroup>
<PropertyGroup>
<Company>Microsoft Corporation</Company>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<RepositoryUrl>https://github.com/microsoft/mcp</RepositoryUrl>
</PropertyGroup>
</Project>