eng/Directory.Build.Common.props (203 lines of code) (raw):

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- Setup project type properties --> <PropertyGroup> <IsMgmtLibrary Condition="'$(IsMgmtLibrary)' == '' and $(MSBuildProjectName.StartsWith('Azure.ResourceManager'))">true</IsMgmtLibrary> <IsMgmtSubLibrary Condition="'$(IsMgmtSubLibrary)' == '' and $(MSBuildProjectName.StartsWith('Azure.ResourceManager.'))">true</IsMgmtSubLibrary> <MgmtAutorestVersion>3.0.0-beta.20210504.1</MgmtAutorestVersion> <!-- Enable documentation for all projects unless explicitly disabled. --> <DocumentationFile>$(IntermediateOutputPath)$(TargetFramework)\$(MSBuildProjectName).xml</DocumentationFile> <!-- Client in this context is any library that is following the new Azure SDK guidelines --> <IsGeneratorLibrary Condition="'$(IsGeneratorLibrary)' == '' and $(MSBuildProjectName.StartsWith('Azure.Generator'))">true</IsGeneratorLibrary> <IsClientLibrary Condition="'$(IsClientLibrary)' == '' and $(MSBuildProjectName.StartsWith('Azure.'))">true</IsClientLibrary> <IsFunctionsLibrary Condition="'$(IsFunctionsLibrary)' == '' and $(MSBuildProjectName.StartsWith('Microsoft.Azure.WebJobs.Extensions.'))">true</IsFunctionsLibrary> <IsSourceGenerator Condition="'$(IsSourceGenerator)' == '' and $(MSBuildProjectName.EndsWith('.SourceGeneration'))">true</IsSourceGenerator> <IsTestProject Condition="'$(IsTestProject)' == '' and $(MSBuildProjectName.EndsWith('.Tests'))">true</IsTestProject> <IsSamplesProject Condition="'$(IsSamplesProject)' == '' and $(MSBuildProjectName.EndsWith('.Samples'))">true</IsSamplesProject> <IsPerfProject Condition="'$(IsPerfProject)' == '' and $(MSBuildProjectName.EndsWith('.Perf'))">true</IsPerfProject> <IsStressProject Condition="'$(IsStressProject)' == '' and $(MSBuildProjectName.EndsWith('.Stress'))">true</IsStressProject> <IsTestSupportProject Condition="'$(IsTestSupportProject)' == '' and '$(IsTestProject)' != 'true' and ($(MSBuildProjectDirectory.Contains('/tests/')) or $(MSBuildProjectDirectory.Contains('\tests\')))">true</IsTestSupportProject> <IsShippingLibrary Condition="'$(IsShippingLibrary)' == '' and '$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true' and '$(IsPerfProject)' != 'true' and '$(IsSamplesProject)' != 'true' and '$(IsStressProject)' != 'true'">true</IsShippingLibrary> <IsShippingClientLibrary Condition="'$(IsClientLibrary)' == 'true' and '$(IsShippingLibrary)' == 'true' and '$(IsSourceGenerator)' != 'true'">true</IsShippingClientLibrary> <TestFrameworkSupportFiles>$(MSBuildThisFileDirectory)/../sdk/core/Azure.Core.TestFramework/src/Shared/*.cs</TestFrameworkSupportFiles> <IncludeOperationsSharedSource Condition="'$(IncludeOperationsSharedSource)' == '' and '$(IsMgmtLibrary)' == 'true' and '$(IsTestProject)' != 'true' and '$(IsPerfProject)' != 'true'">true</IncludeOperationsSharedSource> </PropertyGroup> <!-- Setup default project properties --> <PropertyGroup> <LangVersion>latest</LangVersion> <!-- Disable NU5105 NuGet Pack warning that the version is SemVer 2.0. SemVer 2.0 is supported by NuGet since 3.0.0 (July 2015) in some capacity, and fully since 3.5.0 (October 2016). --> <NoWarn>$(NoWarn);NU5105</NoWarn> <!-- https://github.com/dotnet/roslyn-analyzers/issues/5628 --> <NoWarn>$(NoWarn);CA1812</NoWarn> <!-- Disable some NetAnalyzers rules --> <NoWarn> $(NoWarn); CA1716; <!-- avoid using method names that are reserved in other languages --> CA1308; <!-- prefer ToUpperInvariant --> CA1819; <!-- Properties should not return arrays --> CA1710; <!-- Use Collection sufix --> CA1028; <!-- Enum backing type should be int --> CA1032; <!-- Add default exception ctors --> CA1063; <!-- Dispose implementation --> CA1066; <!-- Implement IEquatable --> CA1815; <!-- Equality members on structs --> CA2007; <!-- Do not directly await a Task without calling ConfigureAwait (replaced by AZC0012) --> CA2231; <!-- Override Equality operators --> CA2225; <!-- Provide alternative to implicit operators --> CA1714; <!-- Flags should have plural names --> CA1062; <!-- Public parameter should be checked for null --> CA1031; <!-- Don't catch generic exceptions --> CA2000; <!-- Call dispose on IDisposable objects --> CA2012; <!-- ValueTask should only be awaited once - conflicts with EnsureCompleted check --> </NoWarn> <!-- Disable some MSBuild warnings --> <NoWarn> $(NoWarn); MSB3245; <!-- Do not warn if a package reference is unavailable --> </NoWarn> <!-- Experimental Azure SDK features --> <NoWarn> $(NoWarn); AZPROVISION001; <!-- Provisioning --> </NoWarn> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <!-- .NET 8 now produces security warnings for nuget packages in dotnet restore. We want to keep all but critical (NU1904) as warnings and not turn them to errors. For T1 we want to keep them all as warnings as we cannot easily fix them all currently and plan to remove the libraries in the future. See: https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1901-nu1904 --> <WarningsNotAsErrors>$(WarningsNotAsErrors);NU1901;NU1902;NU1903</WarningsNotAsErrors> <WarningsNotAsErrors Condition="'$(IsClientLibrary)' != 'true'">$(WarningsNotAsErrors);NU1904</WarningsNotAsErrors> <EmbedUntrackedSources>true</EmbedUntrackedSources> <IncludeSymbols>true</IncludeSymbols> <SymbolPackageFormat>symbols.nupkg</SymbolPackageFormat> <!-- Avoid implicitly added preview feeds --> <AddDotnetfeedProjectSource>false</AddDotnetfeedProjectSource> </PropertyGroup> <PropertyGroup> <EnableClientSdkAnalyzers Condition="'$(IsShippingClientLibrary)' == 'true'">true</EnableClientSdkAnalyzers> <EnableMicrosoftCodeAnalysisNetAnalyzers Condition="'$(IsShippingClientLibrary)' == 'true'">true</EnableMicrosoftCodeAnalysisNetAnalyzers> <EnableStyleCopAnalyzers Condition="'$(EnableStyleCopAnalyzers)' == '' and '$(IsClientLibrary)' == 'true'">true</EnableStyleCopAnalyzers> <EnableBannedApiAnalyzers Condition="'$(IsShippingClientLibrary)' == 'true'">true</EnableBannedApiAnalyzers> <GenerateAPIListing Condition="'$(IsShippingClientLibrary)' == 'true'">true</GenerateAPIListing> <UpdateSourceOnBuild Condition="'$(UpdateSourceOnBuild)' == ''">$(AZURE_DEV_UPDATESOURCESONBUILD)</UpdateSourceOnBuild> <PowerShellExe Condition="'$(PowerShellExe)' == ''">pwsh</PowerShellExe> <InheritDocEnabled Condition="'$(InheritDocEnabled)'=='' and '$(DesignTimeBuild)'!='true' and '$(BuildingForLiveUnitTesting)'!='true' and '$(IsShippingClientLibrary)' == true">true</InheritDocEnabled> <InheritDocTrimLevel>private</InheritDocTrimLevel> <GenerateAPIListing Condition="'$(GenerateAPIListing)' == '' AND '$(IsShippingClientLibrary)' == 'true'">true</GenerateAPIListing> <EnableSourceLink Condition="'$(EnableSourceLink)' == ''">true</EnableSourceLink> <DefineConstants Condition="'$(BuildSnippets)' == 'true'">$(DefineConstants);SNIPPET</DefineConstants> <ApiCompatBaselineTargetFramework Condition="'$(TargetFramework)' == 'net8.0'">netstandard2.0</ApiCompatBaselineTargetFramework> </PropertyGroup> <PropertyGroup Condition="'$(IsShippingClientLibrary)' == 'true' and '$(TF_BUILD)' == 'true'"> <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> </PropertyGroup> <!-- TODO. REVIEW --> <PropertyGroup Condition="'$(IsMgmtLibrary)' == 'true'"> <NoWarn> $(NoWarn); CA1812; <!-- Avoid uninstantiated internal classes. (Result from below including the Azure.Core source) --> AZC0012; <!-- Single word class names --> AZC0008; </NoWarn> </PropertyGroup> <!-- CodeAnalysis RuleSet --> <PropertyGroup Condition="'$(IsClientLibrary)' == 'true'"> <CodeAnalysisRuleSet>$(RepoEngPath)\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <!-- TargetFramework default properties --> <!-- Update pipelines/templates/steps/install-dotnet.yml as needed, without re-installing SDKs already found on all supported agents --> <PropertyGroup> <!-- Client libraries are moving forward to NS 2.0 and Net 4.6.1 as the min supported versions --> <SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == '' and '$(IsClientLibrary)' == 'true'">true</SupportsNetStandard20> <SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == ''">false</SupportsNetStandard20> <RequiredTargetFrameworks>net452;net461;netstandard2.0</RequiredTargetFrameworks> <RequiredTargetFrameworks Condition="'$(SupportsNetStandard20)' == 'true' and '$(IsSourceGenerator)' != 'true'">net8.0;netstandard2.0</RequiredTargetFrameworks> <RequiredTargetFrameworks Condition="'$(IsGeneratorLibrary)' == 'true'">net8.0</RequiredTargetFrameworks> <RequiredTargetFrameworks Condition="'$(IsSourceGenerator)' == 'true'">netstandard2.0</RequiredTargetFrameworks> </PropertyGroup> <PropertyGroup Condition="'$(IsGeneratorLibrary)' != 'true' and ('$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsSamplesProject)' == 'true' or '$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true')"> <IsPackable>false</IsPackable> <!-- List newest targets first so that recordings are made with latest, running tests from editor runs latest, etc. --> <RequiredTargetFrameworks>net9.0;net8.0;</RequiredTargetFrameworks> <!-- Also test net462 on Windows. net461 is out of support as of 4/2022 and is not supported in version 4.4.x and beyond of NUnit3TestAdapter. --> <RequiredTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(RequiredTargetFrameworks);net462</RequiredTargetFrameworks> <!-- But only build snippets for the latest. --> <RequiredTargetFrameworks Condition="'$(BuildSnippets)' == 'true'">net9.0</RequiredTargetFrameworks> </PropertyGroup> <ItemGroup Condition="'$(IsMgmtSubLibrary)' == 'true' and !$(MSBuildProjectName.Equals('Azure.ResourceManager.Tests'))"> <PackageReference Include="Azure.ResourceManager" /> </ItemGroup> <PropertyGroup> <TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks> <IsTargetingNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</IsTargetingNetFx> <IsTargetingNetStandard Condition="$(TargetFramework.StartsWith('netstandard'))">true</IsTargetingNetStandard> <IsTargetingNetCoreApp Condition="$(TargetFramework.StartsWith('netcoreapp'))">true</IsTargetingNetCoreApp> <DefineConstants Condition="'$(IsTargetingNetFx)' == 'true'">$(DefineConstants);FullNetFx</DefineConstants> </PropertyGroup> <!-- SourceGeneration common settings --> <PropertyGroup Condition="'$(IsSourceGenerator)' == 'true'"> <OutputItemType>Analyzer</OutputItemType> <AnalyzerLanguage>cs</AnalyzerLanguage> <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> </PropertyGroup> <!-- Common library and package properties --> <PropertyGroup> <Company>Microsoft Corporation</Company> <Copyright>© Microsoft Corporation. All rights reserved.</Copyright> <Authors>Microsoft</Authors> <Product>Azure .NET SDK</Product> <PackageIcon>pkgicon.png</PackageIcon> <PackageIconPath>$(RepoEngPath)/images/$(PackageIcon)</PackageIconPath> <RepositoryUrl>https://github.com/Azure/azure-sdk-for-net</RepositoryUrl> <PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl> <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> <PackageLicenseExpression>MIT</PackageLicenseExpression> <NeutralLanguage>en-US</NeutralLanguage> </PropertyGroup> <!-- Signing properties --> <PropertyGroup> <SignAssembly>true</SignAssembly> <!-- In order to be able to run our tests on .NET Framework we should use public signing by default so we don't have to disable strong name validation for things that are delay signed. --> <PublicSign Condition="'$(PublicSign)' == ''">true</PublicSign> <DelaySign Condition="'$(PublicSign)' == 'true'">false</DelaySign> <DelaySign Condition="'$(PublicSign)' != 'true'">true</DelaySign> <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)MSSharedLibKey.snk</AssemblyOriginatorKeyFile> </PropertyGroup> <!-- Disable documentation for projects that need fixes before this can be enabled. --> <PropertyGroup Condition=" $(MSBuildProjectName.Equals('Microsoft.Azure.ApplicationInsights.Query')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.AnomalyDetector')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Language.LUIS.Authoring')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Language.SpellCheck')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Language.TextAnalytics')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Personalizer')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingAutoSuggest')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingCustomImageSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingCustomSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingEntitySearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingImageSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingLocalSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingNewsSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingVideoSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingVisualSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Search.BingWebSearch')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Vision.ComputerVision')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Vision.ContentModerator')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Vision.Face')) or $(MSBuildProjectName.Equals('Microsoft.Azure.CognitiveServices.Vision.FormRecognizer')) or $(MSBuildProjectName.Equals('Microsoft.Azure.ContainerRegistry')) or $(MSBuildProjectName.Equals('Microsoft.Azure.EventGrid')) or $(MSBuildProjectName.Equals('Microsoft.Azure.HDInsight.Job')) or $(MSBuildProjectName.Equals('Microsoft.Azure.Graph.RBAC')) or $(MSBuildProjectName.Equals('Microsoft.Azure.KeyVault')) or $(MSBuildProjectName.Equals('Microsoft.Azure.KeyVault.Core')) or $(MSBuildProjectName.Equals('Microsoft.Azure.KeyVault.Cryptography')) or $(MSBuildProjectName.Equals('Microsoft.Azure.KeyVault.Extensions')) or $(MSBuildProjectName.Equals('Microsoft.Azure.KeyVault.WebKey')) or $(MSBuildProjectName.Equals('Microsoft.Azure.OperationalInsights')) or $(MSBuildProjectName.Equals('Microsoft.Azure.Synapse'))"> <DocumentationFile></DocumentationFile> </PropertyGroup> <PropertyGroup Condition="'$(IsClientLibrary)' == 'true'"> <PackageIcon>azureicon.png</PackageIcon> <PackageIconPath>$(RepoEngPath)/images/$(PackageIcon)</PackageIconPath> <!-- Use a full key for the new client libraries and disable delay signing --> <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)AzureSDKClient.snk</AssemblyOriginatorKeyFile> <DelaySign>false</DelaySign> <PublicSign>false</PublicSign> <ImportDefaultReferences>false</ImportDefaultReferences> <!-- The set of tags that should be added to the packages --> <PackageCommonTags>windowsazureofficial;azureofficial</PackageCommonTags> <AzureCoreSharedSources>$(MSBuildThisFileDirectory)/../sdk/core/Azure.Core/src/Shared/</AzureCoreSharedSources> <AzureCoreTestFramework>$(MSBuildThisFileDirectory)/../sdk/core/Azure.Core.TestFramework/src/Azure.Core.TestFramework.csproj</AzureCoreTestFramework> <AzureCoreAmqpSharedSources>$(MSBuildThisFileDirectory)/../sdk/core/Azure.Core.Amqp/src/Shared/</AzureCoreAmqpSharedSources> </PropertyGroup> <PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsSamplesProject)' == 'true' or '$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true'"> <!-- Always fully sign test assemblies since we have a full public/private key --> <PublicSign>false</PublicSign> <DelaySign>false</DelaySign> <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)AzSdkTestLibKey.snk</AssemblyOriginatorKeyFile> <!-- Disable doc comments for test projects --> <DocumentationFile></DocumentationFile> <RunSettingsFilePath Condition="'$(AZURE_SKIP_DEFAULT_RUN_SETTINGS)' != 'true'">$(RepoEngPath)\nunit.runsettings</RunSettingsFilePath> </PropertyGroup> <PropertyGroup Condition="'$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true'"> <ServerGarbageCollection>true</ServerGarbageCollection> </PropertyGroup> <!-- Code generation settings --> <PropertyGroup> <!-- Don't use code generator bundled Azure.Core shared source for code generation --> <AzureCoreSharedCodeDirectory>$(AzureCoreSharedSources)</AzureCoreSharedCodeDirectory> <!-- Don't use code generator bundled Azure.Core shared source when building, projects in this repo include individual sources when needed --> <IncludeAzureCoreSharedCode>false</IncludeAzureCoreSharedCode> </PropertyGroup> </Project>