Skip to content

Enable central package management in repo #3333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,12 @@ steps:
$parent_xpath = '/Project/ItemGroup/PackageReference[@Include="Microsoft.Data.SqlClient"]'
$node = $Doc.SelectSingleNode($parent_xpath)

if($node -ne $null){
$node.Version="${{parameters.nugetPackageVersion }}"
}
else{
if($node -eq $null){
$packagerefnode = $doc.createelement("packagereference")
$value = $doc.selectsinglenode('/project/itemgroup/projectreference')
$attrinclude = $doc.createattribute("include")
$attrinclude.value = "microsoft.data.sqlclient"
$attrversion = $doc.createattribute("version")
$attrversion.value = "${{parameters.nugetPackageVersion }}"
$packagerefnode.attributes.append($attrinclude)
$packagerefnode.attributes.append($attrversion)
$parentNode.AppendChild($packageRefNode)
}

Expand Down
9 changes: 4 additions & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup Condition="$(BuildForRelease) == 'true'">
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
</ItemGroup>
<PropertyGroup Condition="$(Configuration.Contains('Debug'))">
<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
Expand Down Expand Up @@ -69,7 +69,7 @@
<PropertyGroup Condition="'$(BuildSimulator)' == 'true'">
<DefineConstants>$(DefineConstants);ENCLAVE_SIMULATOR</DefineConstants>
</PropertyGroup>

<!-- NuGet Audit Settings -->
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<!--
Expand Down Expand Up @@ -100,11 +100,10 @@

<!-- Provides Version properties -->
<Import Project="$(ToolsDir)props\Versions.props" />
<Import Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Project="$(ToolsDir)props\VersionsNet9OrLater.props" />
<!-- Provides Tool properties -->
<Import Project="$(ToolsDir)props\Tools.props" />
<!-- Provides Build properties -->
<Import Project="$(ToolsDir)props\AssemblyInfo.props" />
<Import Project="$(ToolsDir)props\AssemblyInfo.props" />
<Import Project="$(ToolsDir)props\AssemblyRef.props" />
<Import Project="$(ToolsDir)targets\RepositoryInfo.targets" />

Expand Down
68 changes: 68 additions & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<!-- NetFx project dependencies -->
<ItemGroup>
<PackageVersion Include="Microsoft.Data.SqlClient.SNI" Version="6.0.2" />
<PackageVersion Include="System.Buffers" Version="4.5.1" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="System.Data.Common" Version="4.3.0" />
</ItemGroup>
<!-- NetFx and NetCore project dependencies -->
<ItemGroup>
<PackageVersion Include="Azure.Identity" Version="1.13.2" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="7.7.1" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
</ItemGroup>
<!-- NetCore project dependencies -->
<ItemGroup>
<PackageVersion Include="Microsoft.Data.SqlClient.SNI.runtime" Version="6.0.2" />
<PackageVersion Include="Microsoft.SqlServer.Server" Version="1.0.0" />
</ItemGroup>
<!-- AKV Provider project dependencies -->
<ItemGroup>
<PackageVersion Include="Azure.Core" Version="[1.44.1,2.0.0)" />
<PackageVersion Include="Azure.Security.KeyVault.Keys" Version="[4.7.0,5.0.0)" />
</ItemGroup>
<!-- Test Project Dependencies -->
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageVersion Include="Microsoft.DotNet.RemoteExecutor" Version="10.0.0-beta.25164.6" />
<PackageVersion Include="Microsoft.DotNet.XUnitExtensions" Version="10.0.0-beta.25164.6" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.SqlServer.SqlManagementObjects" Version="172.76.0" />
<PackageVersion Include="Microsoft.SqlServer.Types" Version="160.1000.6" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="System.Data.Odbc" Version="8.0.1" />
<PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="8.0.1" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="xunit.runner.console" Version="2.9.2" />
</ItemGroup>

<!-- Target framework specific dependencies -->
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Include="Microsoft.Bcl.Cryptography" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.5" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="9.0.5" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net9.0'">
<PackageVersion Include="Microsoft.Bcl.Cryptography" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>
<!--Generating Strong Name-->
<!--Generating Strong Name-->
<PropertyGroup Condition="'$(CDP_BUILD_TYPE)'=='Official'">
<SignAssembly>true</SignAssembly>
<KeyFile>$(SigningKeyPath)</KeyFile>
Expand All @@ -30,16 +30,16 @@
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
<EmbeddedFiles Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ProjectReference Condition="'$(TargetGroup)'=='netcoreapp' AND !$(ReferenceType.Contains('Package'))" Include="$(NetCoreSource)src\Microsoft.Data.SqlClient.csproj" />
<ProjectReference Condition="'$(TargetGroup)'=='netfx' AND !$(ReferenceType.Contains('Package'))" Include="$(NetFxSource)src\Microsoft.Data.SqlClient.csproj" />
<PackageReference Condition="$(ReferenceType.Contains('Package'))" Include="Microsoft.Data.SqlClient" Version="$(TestMicrosoftDataSqlClientVersion)" />
<PackageReference Condition="$(ReferenceType.Contains('Package'))" Include="Microsoft.Data.SqlClient" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" Version="$(AzureCoreVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebVersion)" />
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="$(AzureSecurityKeyVaultKeysVersion)" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryVersion)" />
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<Import Project="..\..\Directory.Packages.props" />
<ItemGroup Condition="$(ReferenceType) == 'Package'">
<PackageVersion Include="Microsoft.Data.SqlClient" Version="$(TestMicrosoftDataSqlClientVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PropertyGroup Condition="$(CDP_BUILD_TYPE)!=Official">
<AssemblyOriginatorKeyFile>$(SigningKeyPath)</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<Compile Include="Microsoft.Data.SqlClient.cs" />
<Compile Include="Microsoft.Data.SqlClient.Manual.cs" />
Expand All @@ -32,17 +32,17 @@
<Compile Include="..\..\ref\Microsoft.Data.SqlClient.Batch.NetCoreApp.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" Version="$(MicrosoftDataSqlClientSNIRuntimeVersion)" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryVersion)" />
<PackageReference Include="Microsoft.SqlServer.Server" Version="$(MicrosoftSqlServerServerVersion)" />
<PackageReference Include="Azure.Identity" Version="$(AzureIdentityVersion)" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectVersion)" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(MicrosoftIdentityModelJsonWebTokensVersion)" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="$(SystemSecurityCryptographyPkcsVersion)" />
<PackageReference Include="Microsoft.Bcl.Cryptography" Version="$(MicrosoftBclCryptographyVersion)" />
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="Microsoft.SqlServer.Server" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="System.Security.Cryptography.Pkcs" />
<PackageReference Include="Microsoft.Bcl.Cryptography" />
</ItemGroup>

<Import Project="$(ToolsDir)targets\ResolveContract.targets" Condition="'$(OSGroup)' == 'AnyOS' AND '$(TargetGroup)' != 'netcoreapp'" />
<Import Project="$(ToolsDir)targets\NotSupported.targets" Condition="'$(OSGroup)' == 'AnyOS' AND '$(TargetGroup)' != 'netcoreapp'" />
<!-- Trim docs for intellisense for ref folder (netcore/netstandard) but not when building for lib folder (only netstandard is built for lib from here) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Product>Core $(BaseProduct)</Product>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<NoWarn>$(NoWarn);IL2026;IL2057;IL2072;IL2075</NoWarn>
<NoWarn>$(NoWarn);IL2026;IL2057;IL2072;IL2075</NoWarn>
<RootNamespace />
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
Expand All @@ -39,7 +39,7 @@
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)" />
<EmbeddedFiles Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
</ItemGroup>
</ItemGroup>
<!-- Contains common items shared between Unix and Windows -->
<ItemGroup Condition="'$(OSGroup)' != 'AnyOS'">
<Compile Include="$(CommonSourceRoot)\Interop\Common\Sni\SniErrors.cs">
Expand Down Expand Up @@ -185,7 +185,7 @@
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\AlwaysEncryptedKeyConverter.cs">
<Link>Microsoft\Data\SqlClient\AlwaysEncryptedKeyConverter.cs</Link>
</Compile>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ApplicationIntent.cs">
<Link>Microsoft\Data\SqlClient\ApplicationIntent.cs</Link>
</Compile>
Expand Down Expand Up @@ -605,7 +605,7 @@
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlDbColumn.cs">
<Link>Microsoft\Data\SqlClient\SqlDbColumn.cs</Link>
</Compile>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlDelegatedTransaction.cs">
<Link>Microsoft\Data\SqlClient\SqlDelegatedTransaction.cs</Link>
</Compile>
Expand Down Expand Up @@ -815,7 +815,6 @@
<Compile Include="Microsoft\Data\SqlClient\TdsParserStateObjectManaged.cs" />
<Compile Include="Microsoft.Data.SqlClient.TypeForwards.cs" />
</ItemGroup>

<!-- Windows only -->
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="$(CommonSourceRoot)\Interop\Windows\Handles\SafeLibraryHandle.netcore.cs">
Expand Down Expand Up @@ -962,11 +961,9 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlTypes\SqlFileStream.Windows.cs">
<Link>Microsoft\Data\SqlTypes\SqlFileStream.Windows.cs</Link>
</Compile>

<Compile Include="Microsoft\Data\SqlClient\TdsParser.Windows.cs" />
<Compile Include="Microsoft\Data\SqlClient\TdsParserStateObjectNative.cs" />
</ItemGroup>

<!-- Unix only -->
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<Compile Include="$(CommonSourceRoot)Microsoft\Data\Common\AdapterUtil.Unix.cs">
Expand Down Expand Up @@ -1005,10 +1002,8 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlTypes\SqlFileStream.netcore.Unix.cs">
<Link>Microsoft\Data\SqlTypes\SqlFileStream.netcore.Unix.cs</Link>
</Compile>

<Compile Include="Microsoft\Data\SqlClient\TdsParser.Unix.cs" />
</ItemGroup>

<!-- Resources -->
<ItemGroup>
<Compile Include="$(CommonSourceRoot)Resources\StringsHelper.cs">
Expand Down Expand Up @@ -1036,20 +1031,19 @@
<Link>Resources\Microsoft.Data.SqlClient.SqlMetaData.xml</Link>
</EmbeddedResource>
</ItemGroup>

<!-- Package References Etc -->
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" Version="$(MicrosoftDataSqlClientSNIRuntimeVersion)" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryVersion)" />
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<!-- Enable the project reference for debugging purposes. -->
<!-- <ProjectReference Include="$(SqlServerSourceCode)\Microsoft.SqlServer.Server.csproj" /> -->
<PackageReference Include="Microsoft.SqlServer.Server" Version="$(MicrosoftSqlServerServerVersion)" />
<PackageReference Include="Azure.Identity" Version="$(AzureIdentityVersion)" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectVersion)" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(MicrosoftIdentityModelJsonWebTokensVersion)" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="$(SystemSecurityCryptographyPkcsVersion)" />
<PackageReference Include="Microsoft.Bcl.Cryptography" Version="$(MicrosoftBclCryptographyVersion)" />
<PackageReference Include="Microsoft.SqlServer.Server" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="System.Security.Cryptography.Pkcs" />
<PackageReference Include="Microsoft.Bcl.Cryptography" />
</ItemGroup>
<Import Project="$(ToolsDir)targets\GenerateThisAssemblyCs.targets" />
<Import Project="$(ToolsDir)targets\ResolveContract.targets" Condition="'$(OSGroup)' == 'AnyOS'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<PropertyGroup>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<TargetFramework>net462</TargetFramework>
<IntermediateOutputPath>$(ObjFolder)$(Configuration)\$(AssemblyName)\ref\</IntermediateOutputPath>
<IntermediateOutputPath>$(ObjFolder)$(Configuration)\$(AssemblyName)\ref\</IntermediateOutputPath>
<OutputPath>$(BinFolder)$(Configuration)\$(AssemblyName)\ref\</OutputPath>
<DocumentationFile>$(OutputPath)\Microsoft.Data.SqlClient.xml</DocumentationFile>
<Product>Framework $(BaseProduct)</Product>
<Configurations>Debug;Release;</Configurations>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<!--Generating Strong Name-->
<!--Generating Strong Name-->
<PropertyGroup Condition="$(CDP_BUILD_TYPE)==Official">
<SignAssembly>true</SignAssembly>
<KeyFile>$(SigningKeyPath)</KeyFile>
Expand All @@ -32,22 +32,20 @@
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebVersion)" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="Microsoft.Data.SqlClient.SNI">
<Version>$(MicrosoftDataSqlClientSniVersion)</Version>
<PrivateAssets>All</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Azure.Identity" Version="$(AzureIdentityVersion)" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectVersion)" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(MicrosoftIdentityModelJsonWebTokensVersion)" />
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
<PackageReference Include="System.Data.Common" Version="$(SystemDataCommonVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="$(SystemSecurityCryptographyPkcsVersion)" />
<PackageReference Include="Microsoft.Bcl.Cryptography" Version="$(MicrosoftBclCryptographyVersion)" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
<PackageReference Include="System.Buffers" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Data.Common" />
<PackageReference Include="System.Security.Cryptography.Pkcs" />
<PackageReference Include="Microsoft.Bcl.Cryptography" />
</ItemGroup>

<Import Project="$(ToolsDir)targets\TrimDocsForIntelliSense.targets" />
</Project>
Loading
Loading