mirror of https://github.com/dotnet/runtime
226 lines
15 KiB
XML
226 lines
15 KiB
XML
<Project>
|
|
<PropertyGroup>
|
|
<!-- Override strong name key to default to Open for test projects,
|
|
Tests which wish to control this should set TestStrongNameKeyId. -->
|
|
<TestStrongNameKeyId Condition="'$(TestStrongNameKeyId)' == '' and $(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">MicrosoftAspNetCore</TestStrongNameKeyId>
|
|
<TestStrongNameKeyId Condition="'$(TestStrongNameKeyId)' == ''">Open</TestStrongNameKeyId>
|
|
<StrongNameKeyId Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true'">$(TestStrongNameKeyId)</StrongNameKeyId>
|
|
</PropertyGroup>
|
|
|
|
<!-- resources.targets need to be imported before the Arcade SDK. -->
|
|
<Import Project="$(RepositoryEngineeringDir)resources.targets" />
|
|
<Import Project="..\..\Directory.Build.targets" />
|
|
|
|
<PropertyGroup>
|
|
<UseDefaultTestHost Condition="'$(UseDefaultTestHost)' == ''">false</UseDefaultTestHost>
|
|
<NetCoreAppCurrentBuildSettings>$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</NetCoreAppCurrentBuildSettings>
|
|
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrentBuildSettings)'))</NativeBinDir>
|
|
<NetCoreAppCurrentTestHostPath Condition="'$(UseDefaultTestHost)' != 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testhost', '$(NetCoreAppCurrentBuildSettings)'))</NetCoreAppCurrentTestHostPath>
|
|
<NetCoreAppCurrentTestHostSharedFrameworkPath Condition="'$(UseDefaultTestHost)' != 'true'">$([MSBuild]::NormalizeDirectory('$(NetCoreAppCurrentTestHostPath)', 'shared', '$(MicrosoftNetCoreAppFrameworkName)', '$(ProductVersion)'))</NetCoreAppCurrentTestHostSharedFrameworkPath>
|
|
<NETStandard21RefPath>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'netstandard.library.ref', '$(NETStandardLibraryRefVersion)', 'ref', 'netstandard2.1'))</NETStandard21RefPath>
|
|
|
|
<NoWarn Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">$(NoWarn);nullable</NoWarn>
|
|
<NoWarn Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' or '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(NoWarn);nullable;CA1052</NoWarn>
|
|
<!-- Ignore Obsolete errors within the generated shims that type-forward types.
|
|
SYSLIB0003: Code Access Security (CAS).
|
|
SYSLIB0004: Constrained Execution Region (CER).
|
|
SYSLIB0017: Strong name signing.
|
|
SYSLIB0021: Derived cryptographic types.
|
|
SYSLIB0022: Rijndael types.
|
|
SYSLIB0023: RNGCryptoServiceProvider.
|
|
SYSLIB0025: SuppressIldasmAttribute.
|
|
SYSLIB0032: HandleProcessCorruptedStateExceptionsAttribute.
|
|
SYSLIB0036: Regex.CompileToAssembly
|
|
-->
|
|
<NoWarn Condition="'$(IsPartialFacadeAssembly)' == 'true'">$(NoWarn);SYSLIB0003;SYSLIB0004;SYSLIB0015;SYSLIB0017;SYSLIB0021;SYSLIB0022;SYSLIB0023;SYSLIB0025;SYSLIB0032;SYSLIB0036</NoWarn>
|
|
|
|
<!-- Ignore analyzers that recommend APIs introduced in .NET Core when targeting frameworks that lack those APIs
|
|
to avoid issues with multitargeting.
|
|
-->
|
|
<NoWarn Condition="$(TargetFrameworks.Contains('net4')) or $(TargetFrameworks.Contains('netstandard'))">$(NoWarn);CA1510;CA1511;CA1512;CA1513;CA1845;CA1846;CA1847</NoWarn>
|
|
|
|
<!-- Microsoft.NET.Sdk enables some warnings as errors out of the box.
|
|
We want to remove some items from this list so they don't fail the build.
|
|
Can't use 'WarningsNotAsErrors' element because vbproj doesn't honor it.
|
|
Items to remove:
|
|
NU1605: Package downgrade detected
|
|
-->
|
|
<WarningsAsErrors>$(WarningsAsErrors.Replace('NU1605', ''))</WarningsAsErrors>
|
|
|
|
<IsRuntimeAndReferenceAssembly Condition="'$(IsRuntimeAndReferenceAssembly)' == '' and
|
|
'$(IsSourceProject)' == 'true' and
|
|
Exists('$(LibrariesProjectRoot)$(MSBuildProjectName)') and
|
|
!Exists('$(LibrariesProjectRoot)$(MSBuildProjectName)$([System.IO.Path]::DirectorySeparatorChar)ref') and
|
|
!$(MSBuildProjectName.StartsWith('System.Private'))">true</IsRuntimeAndReferenceAssembly>
|
|
|
|
<!-- The source of truth for these IsNETCoreApp* properties is NetCoreAppLibrary.props. -->
|
|
<IsNETCoreAppSrc Condition="('$(IsSourceProject)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true') and
|
|
$(NetCoreAppLibrary.Contains('$(AssemblyName);'))">true</IsNETCoreAppSrc>
|
|
<IsNETCoreAppRef Condition="('$(IsReferenceAssemblyProject)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true') and
|
|
$(NetCoreAppLibrary.Contains('$(AssemblyName);')) and
|
|
!$(NetCoreAppLibraryNoReference.Contains('$(AssemblyName);'))">true</IsNETCoreAppRef>
|
|
<IsNETCoreAppAnalyzer Condition="'$(IsGeneratorProject)' == 'true' and
|
|
$(NetCoreAppLibraryGenerator.Contains('$(MSBuildProjectName);'))">true</IsNETCoreAppAnalyzer>
|
|
<!-- Inbox analyzers shouldn't use the live targeting / runtime pack. They better depend on an LKG to avoid layering concerns. -->
|
|
<UseLocalTargetingRuntimePack Condition="'$(IsNETCoreAppAnalyzer)' == 'true'">false</UseLocalTargetingRuntimePack>
|
|
<!-- By default, disable implicit framework references for NetCoreAppCurrent libraries. -->
|
|
<DisableImplicitFrameworkReferences Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
|
|
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)')) and
|
|
('$(IsNETCoreAppRef)' == 'true' or '$(IsNETCoreAppSrc)' == 'true')">true</DisableImplicitFrameworkReferences>
|
|
<!-- Enable trimming for any source project that's part of the shared framework.
|
|
Don't attempt to trim PNSE assemblies which are generated from the reference source. -->
|
|
<ILLinkTrimAssembly Condition="'$(ILLinkTrimAssembly)' == '' and
|
|
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
|
|
'$(IsNETCoreAppSrc)' == 'true' and
|
|
'$(GeneratePlatformNotSupportedAssembly)' != 'true' and
|
|
'$(GeneratePlatformNotSupportedAssemblyMessage)' == ''">true</ILLinkTrimAssembly>
|
|
</PropertyGroup>
|
|
|
|
<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
|
|
<Import Project="$(RepositoryEngineeringDir)intellisense.targets" Condition="'$(IsSourceProject)' == 'true'" />
|
|
|
|
<!-- Libraries-specific binplacing properties -->
|
|
<PropertyGroup>
|
|
<BinPlaceRef Condition="'$(BinPlaceRef)' == '' and ('$(IsReferenceAssemblyProject)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRef>
|
|
<BinPlaceRuntime Condition="'$(BinPlaceRuntime)' == '' and ('$(IsSourceProject)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRuntime>
|
|
<BinPlaceForTargetVertical Condition="'$(BinPlaceForTargetVertical)' == ''">true</BinPlaceForTargetVertical>
|
|
<GetBinPlaceItemsDependsOn Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">$(GetBinPlaceItemsDependsOn);AddDocumentationFileAsBinPlaceItemForExtensionsProjects</GetBinPlaceItemsDependsOn>
|
|
</PropertyGroup>
|
|
|
|
<Target Name="AddDocumentationFileAsBinPlaceItemForExtensionsProjects"
|
|
Condition="Exists('$(DocumentationFile)')">
|
|
<ItemGroup>
|
|
<!-- Microsoft.Extensions are not yet using the doc-file package -->
|
|
<BinPlaceItem Include="$(DocumentationFile)" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<ItemGroup>
|
|
<!-- Used by the runtime tests to prepare the CORE_ROOT layout. Don't use in libraries. -->
|
|
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)"
|
|
Condition="'$(BinPlaceForTargetVertical)' == 'true'">
|
|
<NativePath>$(LibrariesAllBinArtifactsPath)</NativePath>
|
|
<RefPath>$(LibrariesAllRefArtifactsPath)</RefPath>
|
|
<RuntimePath>$(LibrariesAllBinArtifactsPath)</RuntimePath>
|
|
</BinPlaceTargetFrameworks>
|
|
|
|
<!-- Source generator projects might multi-target. Make sure that only the netstandard2.0 compiled assets get binplaced. -->
|
|
<BinPlaceDir Include="$(MicrosoftNetCoreAppRefPackDir)analyzers\dotnet\$(AnalyzerLanguage)"
|
|
Condition="'$(IsNETCoreAppAnalyzer)' == 'true' and
|
|
'$(TargetFramework)' == 'netstandard2.0'" />
|
|
|
|
<!-- Setup the shared framework directory for testing -->
|
|
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)">
|
|
<NativePath>$(NetCoreAppCurrentTestHostSharedFrameworkPath)</NativePath>
|
|
<RuntimePath Condition="'$(IsNETCoreAppSrc)' == 'true'">$(NetCoreAppCurrentTestHostSharedFrameworkPath)</RuntimePath>
|
|
</BinPlaceTargetFrameworks>
|
|
|
|
<!-- Microsoft.NetCore.App.Ref and Microsoft.NetCore.App.Runtime targeting packs -->
|
|
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)">
|
|
<NativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</NativePath>
|
|
<RefPath Condition="'$(IsNETCoreAppRef)' == 'true'">$(MicrosoftNetCoreAppRefPackRefDir)</RefPath>
|
|
<RuntimePath Condition="'$(IsNETCoreAppSrc)' == 'true'">$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</RuntimePath>
|
|
</BinPlaceTargetFrameworks>
|
|
</ItemGroup>
|
|
|
|
<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" />
|
|
|
|
<PropertyGroup>
|
|
<!-- Libraries non test projects shouldn't reference compat shims. -->
|
|
<SkipTargetingPackShimReferences Condition="'$(UseLocalTargetingRuntimePack)' == 'true' and
|
|
'$(IsTestProject)' != 'true' and
|
|
'$(IsTestSupportProject)' != 'true'">true</SkipTargetingPackShimReferences>
|
|
</PropertyGroup>
|
|
|
|
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />
|
|
<Import Project="$(RepositoryEngineeringDir)references.targets" />
|
|
<Import Project="$(RepositoryEngineeringDir)testing\tests.targets" Condition="'$(EnableTestSupport)' == 'true'" />
|
|
<Import Project="$(RepositoryEngineeringDir)testing\linker\trimmingTests.targets" Condition="'$(IsPublishedAppTestProject)' == 'true'" />
|
|
<Import Project="$(RepositoryEngineeringDir)testing\runtimeConfiguration.targets" />
|
|
<Import Project="$(RepositoryEngineeringDir)testing\runsettings.targets" Condition="'$(EnableRunSettingsSupport)' == 'true'" />
|
|
<Import Project="$(RepositoryEngineeringDir)testing\coverage.targets" Condition="'$(EnableRunSettingsSupport)' == 'true' or '$(EnableCoverageSupport)' == 'true'" />
|
|
<Import Project="$(RepositoryEngineeringDir)slngen.targets" Condition="'$(IsSlnGen)' == 'true'" />
|
|
|
|
<Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(IsSourceProject)' == 'true'" />
|
|
<Import Project="$(RepositoryEngineeringDir)AvoidRestoreCycleOnSelfReference.targets" Condition="'$(AvoidRestoreCycleOnSelfReference)' == 'true'" />
|
|
|
|
<ItemGroup Condition="'$(UseTargetFrameworkPackage)' != 'false'">
|
|
<PackageReference Include="Microsoft.DotNet.Build.Tasks.TargetFramework" Version="$(MicrosoftDotNetBuildTasksTargetFrameworkVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
|
|
</ItemGroup>
|
|
|
|
<!-- Reference the GenFacades package when the assembly is a partial facade or a PNSE throwing. -->
|
|
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true' or
|
|
'$(GeneratePlatformNotSupportedAssembly)' == 'true' or
|
|
'$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">
|
|
<PackageReference Include="Microsoft.DotNet.GenFacades" Version="$(MicrosoftDotNetGenFacadesVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
|
|
</ItemGroup>
|
|
|
|
<!-- GenFacades target that is intentionally empty since we no longer need it. -->
|
|
<Target Name="ResolveMatchingContract" />
|
|
|
|
<!--
|
|
Do not clean binplace assets in the ref targeting pack to avoid incremental build failures
|
|
when the SDK tries to resolve the assets from the FrameworkList.
|
|
-->
|
|
<Target Name="RemoveTargetingPackIncrementalClean"
|
|
Condition="'@(AdditionalCleanDirectories)' != ''"
|
|
BeforeTargets="IncrementalCleanAdditionalDirectories;
|
|
CleanAdditionalDirectories">
|
|
<ItemGroup>
|
|
<AdditionalCleanDirectories Remove="@(AdditionalCleanDirectories)" Condition="'%(Identity)' == '$(MicrosoftNetCoreAppRefPackRefDir)'" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<!-- Adds Nullable annotation attributes to C# non .NETCoreApp builds. -->
|
|
<ItemGroup Condition="'$(Nullable)' != '' and
|
|
'$(Nullable)' != 'disable' and
|
|
'$(MSBuildProjectExtension)' == '.csproj' and
|
|
'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
|
|
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
|
|
</ItemGroup>
|
|
|
|
<!-- If a tfm doesn't target .NETCoreApp but uses the platform support attributes, then we include the
|
|
System.Runtime.Versioning*Platform* annotation attribute classes in the project as internal.
|
|
|
|
If a project has specified assembly-level SupportedOSPlatforms or UnsupportedOSPlatforms,
|
|
we can infer the need without having IncludePlatformAttributes set. -->
|
|
<PropertyGroup>
|
|
<IncludePlatformAttributes Condition="'$(IncludePlatformAttributes)' == '' and ('$(SupportedOSPlatforms)' != '' or '$(UnsupportedOSPlatforms)' != '')">true</IncludePlatformAttributes>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup Condition="'$(IncludePlatformAttributes)' == 'true' and '$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
|
|
<Compile Include="$(CoreLibSharedDir)System\Runtime\Versioning\PlatformAttributes.cs" Link="System\Runtime\Versioning\PlatformAttributes.cs" />
|
|
</ItemGroup>
|
|
|
|
<!-- Adds ObsoleteAttribute to projects that need to apply downlevel Obsoletions with DiagnosticId and UrlFormat -->
|
|
<Choose>
|
|
<When Condition="'$(IncludeInternalObsoleteAttribute)' == 'true' and '$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
|
|
<ItemGroup>
|
|
<Compile Include="$(CoreLibSharedDir)System\ObsoleteAttribute.cs" Link="System\ObsoleteAttribute.cs" />
|
|
</ItemGroup>
|
|
<PropertyGroup>
|
|
<!-- Suppress CS0436 to allow ObsoleteAttribute to be internally defined and used in netstandard -->
|
|
<NoWarn>$(NoWarn);CS0436</NoWarn>
|
|
</PropertyGroup>
|
|
</When>
|
|
</Choose>
|
|
|
|
<PropertyGroup>
|
|
<SkipLocalsInit Condition="'$(SkipLocalsInit)' == '' and '$(MSBuildProjectExtension)' == '.csproj' and '$(IsNETCoreAppSrc)' == 'true' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">true</SkipLocalsInit>
|
|
</PropertyGroup>
|
|
|
|
<!--Instructs compiler not to emit .locals init, using SkipLocalsInitAttribute.-->
|
|
<Choose>
|
|
<When Condition="'$(SkipLocalsInit)' == 'true'">
|
|
<PropertyGroup >
|
|
<!-- This is needed to use the SkipLocalsInitAttribute. -->
|
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<Compile Include="$(CommonPath)SkipLocalsInit.cs" Link="Common\SkipLocalsInit.cs" />
|
|
</ItemGroup>
|
|
</When>
|
|
</Choose>
|
|
</Project>
|