build/common.project.props (175 lines of code) (raw):

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0"> <!-- Helper properties --> <PropertyGroup> <IsXPlat>false</IsXPlat> <IsXPlat Condition=" $(MSBuildProjectFullPath.StartsWith('/')) == 'true' OR $(MSBuildProjectFullPath.StartsWith('\')) == 'true' ">true</IsXPlat> </PropertyGroup> <!-- Target Frameworks --> <PropertyGroup> <NETFXTargetFrameworkVersion>v4.7.2</NETFXTargetFrameworkVersion> <NETFXTargetFramework>net472</NETFXTargetFramework> <NetStandardVersion>netstandard2.0</NetStandardVersion> <NETCoreTargetFramework>net8.0</NETCoreTargetFramework> <NETCoreTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildFromVMR)' == 'true'">net10.0</NETCoreTargetFramework> <LatestNETCoreTargetFramework>net9.0</LatestNETCoreTargetFramework> <LatestNETCoreTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildFromVMR)' == 'true'">net10.0</LatestNETCoreTargetFramework> <!-- Target frameworks for class libraries--> <TargetFrameworksLibrary>$(NETCoreTargetFramework)</TargetFrameworksLibrary> <TargetFrameworksLibrary Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(LatestNETCoreTargetFramework)</TargetFrameworksLibrary> <TargetFrameworksLibrary Condition="'$(DotNetBuildSourceOnly)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksLibrary)</TargetFrameworksLibrary> <!-- Target framework for runnable apps --> <TargetFrameworksExe>$(LatestNETCoreTargetFramework)</TargetFrameworksExe> <TargetFrameworksExe Condition="'$(DotNetBuildSourceOnly)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksExe)</TargetFrameworksExe> <!-- Target frameworks for unit tests --> <TargetFrameworksUnitTest>$(LatestNETCoreTargetFramework)</TargetFrameworksUnitTest> <TargetFrameworksUnitTest Condition="'$(DotNetBuildSourceOnly)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksUnitTest)</TargetFrameworksUnitTest> </PropertyGroup> <!-- Common --> <PropertyGroup> <RepositoryRootDirectory>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'README.md'))\</RepositoryRootDirectory> <BuildCommonDirectory>$(RepositoryRootDirectory)build\</BuildCommonDirectory> <SolutionFile>$(RepositoryRootDirectory)$(RepositoryName).sln</SolutionFile> <ArtifactsDirectory>$(RepositoryRootDirectory)artifacts\</ArtifactsDirectory> <DotnetExePath>$(RepositoryRootDirectory)cli\dotnet.exe</DotnetExePath> <DotnetExePath Condition=" '$(IsXPlat)' == 'true' ">$(RepositoryRootDirectory)cli\dotnet</DotnetExePath> <SharedDirectory>$(BuildCommonDirectory)Shared</SharedDirectory> <NupkgOutputDirectory>$(ArtifactsDirectory)nupkgs\</NupkgOutputDirectory> <SolutionPackagesFolder>$(RepositoryRootDirectory)packages\</SolutionPackagesFolder> <EnlistmentRoot>$(RepositoryRootDirectory)</EnlistmentRoot> <EnlistmentRootSrc>$(RepositoryRootDirectory)src</EnlistmentRootSrc> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(RepositoryRootDirectory)</SolutionDir> <ArtifactRoot>$(ArtifactsDirectory)</ArtifactRoot> <ArtifactTempDirectory>$(ArtifactsDirectory)temp</ArtifactTempDirectory> <NoWarn>$(NoWarn);NU5105;MSB3277;NETSDK1138</NoWarn> <!-- additional warnings new in .NET 6 that we need to disable when building with source-build --> <NoWarn Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(NoWarn);CS1998;CA1416;CS0618;CS1574</NoWarn> <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> <DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder> <Nullable>enable</Nullable> </PropertyGroup> <!-- Defaults --> <PropertyGroup> <TreatWarningsAsErrors Condition=" '$(TreatWarningsAsErrors)' == '' ">true</TreatWarningsAsErrors> <WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors> <!-- Treat all warnings as errors, except on official builds since we don't want new warnings to break servicing branches --> <!-- MSBuild currently has a bug: https://github.com/dotnet/msbuild/issues/10801 --> <!-- <MSBuildTreatWarningsAsErrors Condition=" '$(MSBuildTreatWarningsAsErrors)' == '' And '$(IsOfficialBuild)' != 'true' ">true</MSBuildTreatWarningsAsErrors> --> </PropertyGroup> <!-- Default project configuration --> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">17.0</VisualStudioVersion> <NuGetTargets>$(MSBuildExtensionsPath)\Microsoft\NuGet\$(VisualStudioVersion)\Microsoft.NuGet.targets</NuGetTargets> <ComVisible>false</ComVisible> </PropertyGroup> <!-- Common project build settings --> <PropertyGroup> <PlatformTarget>$(Platform)</PlatformTarget> <Prefer32Bit>false</Prefer32Bit> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <NoWarn>$(NoWarn);NU5105</NoWarn> <!-- Code Analysis is OFF by default --> <RunCodeAnalysis Condition=" '$(RunCodeAnalysis)' == ''">false</RunCodeAnalysis> <!--This property ensures that if you build the exact sources twice, you get exactly the same output, so the .pdb from the second build will match the .dll from the first build!--> <Deterministic>true</Deterministic> <Features>strict</Features> <!-- Same as SDK default, but without CandidateAssemblyFiles in front, which would search in Content items --> <AssemblySearchPaths>{HintPathFromItem};{TargetFrameworkDirectory};{RawFileName}</AssemblySearchPaths> <LangVersion>12</LangVersion> <LangVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">latest</LangVersion> </PropertyGroup> <!-- NuGet's dev branch always targets the next upcoming version of .NET, so we always use the preview SDK --> <PropertyGroup Condition=" '$(IsEscrow)' != 'true' "> <SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage> </PropertyGroup> <!-- DEBUG specific configuration settings --> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <DefineConstants>DEBUG;TRACE</DefineConstants> </PropertyGroup> <!-- RELEASE specific configuration settings --> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <DefineConstants>TRACE</DefineConstants> </PropertyGroup> <PropertyGroup> <MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion> <VsixOutputDirName>VS15</VsixOutputDirName> <EnableNETAnalyzers>true</EnableNETAnalyzers> <EnableNETAnalyzers Condition="'$(DotNetBuildSourceOnly)' == 'true'">false</EnableNETAnalyzers> <AnalysisLevel>8.0-None</AnalysisLevel> <EnforceCodeStyleInBuild Condition="'$(EnforceCodeStyleInBuild)' == ''">true</EnforceCodeStyleInBuild> <NoWarn>$(NoWarn);EnableGenerateDocumentationFile</NoWarn> </PropertyGroup> <PropertyGroup> <VsixPublishDestination>$(ArtifactRoot)$(VsixOutputDirName)\</VsixPublishDestination> </PropertyGroup> <!-- Write out .XML files for projects all projects, required to enforce IDE0005 on build. --> <PropertyGroup> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> <!-- Set the output location for all non-test projects --> <!-- Test projects currently fail when the output dir is moved --> <PropertyGroup Condition=" '$(TestProject)' != 'true' OR '$(Shipping)' == 'true'"> <!-- output paths --> <BaseIntermediateOutputPath>$(ArtifactsDirectory)$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath> <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath> <BaseOutputPath>$(ArtifactsDirectory)$(MSBuildProjectName)\bin\</BaseOutputPath> <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> <AppxPackageDir>$(OutputPath)</AppxPackageDir> </PropertyGroup> <PropertyGroup> <FileVersion>$(SemanticVersion).$(PreReleaseVersion)</FileVersion> <InformationalVersion Condition="'$(BUILD_SOURCEVERSION)' == ''">$(SemanticVersion)$(PreReleaseInformationVersion)</InformationalVersion> <InformationalVersion Condition="'$(BUILD_SOURCEVERSION)' != ''">$(SemanticVersion)$(PreReleaseInformationVersion)+$(BUILD_SOURCEVERSION)</InformationalVersion> <Company>Microsoft Corporation</Company> <Product>NuGet</Product> <Copyright>&#169; Microsoft Corporation. All rights reserved.</Copyright> <NeutralLanguage>en-US</NeutralLanguage> <SchemaVersion>2.0</SchemaVersion> <TypeScriptCompileBlocked>True</TypeScriptCompileBlocked> <ProduceOutputsOnBuild>True</ProduceOutputsOnBuild> </PropertyGroup> <!-- Add symbols to the dll for test dlls --> <PropertyGroup Condition=" '$(TestProject)' == 'true' "> <DebugType>full</DebugType> </PropertyGroup> <!-- The project that builds the VSIX --> <PropertyGroup> <VSIXProject>$(RepositoryRootDirectory)src\NuGet.Clients\NuGet.VisualStudio.Client\NuGet.VisualStudio.Client.csproj</VSIXProject> </PropertyGroup> <!-- Find all test projects --> <ItemGroup Condition=" '$(IsXPlat)' != 'true' "> <CoreUnitTestProjects Include="$(RepositoryRootDirectory)test\NuGet.Core.Tests\*\*.csproj" Exclude="$(RepositoryRootDirectory)test\NuGet.Core.Tests\NuGet.PackageManagement.Test\*.csproj"/> <VSUnitTestProjects Include="$(RepositoryRootDirectory)test\NuGet.Clients.Tests\*\*.csproj" Exclude="$(RepositoryRootDirectory)test\NuGet.Clients.Tests\NuGet.CommandLine.Test\*.csproj" /> <CoreFuncTestProjects Include="$(RepositoryRootDirectory)test\NuGet.Core.FuncTests\*\*.csproj; $(RepositoryRootDirectory)test\NuGet.Clients.Tests\NuGet.CommandLine.Test\*.csproj; $(RepositoryRootDirectory)test\NuGet.Core.Tests\NuGet.PackageManagement.Test\*.csproj; $(RepositoryRootDirectory)test\NuGet.Clients.FuncTests\*\*.csproj" Exclude="$(RepositoryRootDirectory)test\NuGet.Core.FuncTests\NuGet.Signing.CrossFramework.Test\*.csproj" /> </ItemGroup> <!-- start with only nuget.versioning for xplat --> <ItemGroup Condition=" '$(IsXPlat)' == 'true' "> <CoreUnitTestProjects Include="$(RepositoryRootDirectory)test\NuGet.Core.Tests\*\*.csproj" Exclude="$(RepositoryRootDirectory)test\NuGet.Core.Tests\*PackageManagement*\*.csproj; $(RepositoryRootDirectory)test\NuGet.Core.Tests\*ProjectManagement*\*.csproj; $(RepositoryRootDirectory)test\NuGet.Core.Tests\*VisualStudio*\*.csproj; $(RepositoryRootDirectory)test\NuGet.Core.Tests\*.Utility\*.csproj; $(RepositoryRootDirectory)test\NuGet.Core.Tests\NuGet.Credentials.Test\*.csproj;" /> <CoreFuncTestProjects Include="$(RepositoryRootDirectory)test\NuGet.Core.FuncTests\*\*.csproj" Exclude="$(RepositoryRootDirectory)test\NuGet.Core.FuncTests\NuGet.Signing.CrossFramework.Test\*.csproj; $(RepositoryRootDirectory)test\NuGet.Core.FuncTests\Msbuild.Integration.Test\*.csproj" /> </ItemGroup> <!-- All projects in the repository --> <ItemGroup Condition=" '$(IsXPlat)' != 'true' "> <SolutionProjects Include="$(RepositoryRootDirectory)test\*\*\*.csproj" Exclude="$(RepositoryRootDirectory)test\EndToEnd\*\*.csproj; $(RepositoryRootDirectory)test\NuGet.Tests.Apex\*\*.csproj" Condition=" '$(ExcludeTestProjects)' != 'true' " /> <SolutionProjects Include="$(RepositoryRootDirectory)test\NuGet.Tests.Apex\*\*.csproj" Condition="'$(IncludeApex)' == 'true'" /> <SolutionProjects Include="$(RepositoryRootDirectory)src\*\*\*.csproj" /> <SolutionProjectsWithoutVSIX Include="@(SolutionProjects)" Exclude="$(VSIXProject)" /> </ItemGroup> <!-- All projects in the repository that support cross platform builds --> <ItemGroup Condition=" '$(IsXPlat)' == 'true' "> <SolutionProjects Include="@(CoreUnitTestProjects)" /> <SolutionProjects Include="@(CoreFuncTestProjects)" /> </ItemGroup> <ItemGroup> <ProductProjects Include="$(RepositoryRootDirectory)src\*\*\*.csproj" /> </ItemGroup> <!-- All projects that build assemblies that are inserted into the .NET SDK --> <ItemGroup> <CoreProjects Include="$(RepositoryRootDirectory)src\NuGet.Core\*\*.csproj" Exclude="$(RepositoryRootDirectory)src\NuGet.Core\NuGet.PackageManagement\NuGet.PackageManagement.csproj; $(RepositoryRootDirectory)src\NuGet.Core\NuGet.Localization\NuGet.Localization.csproj; $(RepositoryRootDirectory)src\NuGet.Core\NuGet.Resolver\NuGet.Resolver.csproj" /> </ItemGroup> <ItemGroup Condition=" '$(IsXPlat)' != 'true' "> <ApexProjects Include="$(RepositoryRootDirectory)test\NuGet.Tests.Apex\*\*.csproj" /> </ItemGroup> <ItemGroup Condition=" '$(IsXPlat)' != 'true' "> <AllRepoProjects Include="@(SolutionProjects)" /> <AllRepoProjects Include="@(ApexProjects)" /> </ItemGroup> <Import Project="OptProfV2.props"/> </Project>