Skip to content

Build | Correct references to Microsoft.SqlServer.Server in Visual Studio builds#4003

Open
edwardneal wants to merge 5 commits intodotnet:mainfrom
edwardneal:build/visual-studio
Open

Build | Correct references to Microsoft.SqlServer.Server in Visual Studio builds#4003
edwardneal wants to merge 5 commits intodotnet:mainfrom
edwardneal:build/visual-studio

Conversation

@edwardneal
Copy link
Contributor

Description

This follows up my previous PR - I can't currently build via Visual Studio. Upon trying to do so, the net8.0, net9.0 and net10.0 targets for ManualTests fail with the error:

The type 'IBinarySerialize' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.SqlServer.Server, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'.

The versioning for Microsoft.SqlServer.Server is also wrong because the package is versioned independently of SqlClient and its associated libraries, but this doesn't break the build - and more importantly, threading the package-specific versions into Microsoft.SqlServer.Server just changes the version in the error message:

The type 'IBinarySerialize' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.SqlServer.Server, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Converting netcore's unconditional PackageReference into the newer style of PackageReference/ProjectReference fixes this problem.

Just to neaten up the version numbers and dependencies, we then return to Microsoft.SqlServer.Server and bring the build configuration into the same style as the Abstractions project file, adding the various version-related properties and making sure that these are threaded into the nuspec.

Issues

None.

Testing

Visual Studio builds from scratch. build.proj continues to function properly, setting correct dependencies on Microsoft.SqlServer.Server. I can continue to execute UDT-based tests in ManualTests, so the updated DLL loads properly.

@edwardneal edwardneal requested a review from a team as a code owner March 5, 2026 19:14
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Mar 5, 2026
<Exec Command="powershell.exe -NonInteractive -executionpolicy Unrestricted ^
-command &quot;&amp;$(ToolsDir)scripts\downloadLatestNuget.ps1 -nugetDestPath '$(NuGetRoot)'&quot;" />
<Exec Command="$(NuGetCmd) pack -Symbols -SymbolPackageFormat snupkg $(ToolsDir)specs\Microsoft.Data.SqlClient.nuspec -Version $(MdsPackageVersion) -OutputDirectory $(PackagesDir) -properties &quot;COMMITID=$(CommitId);Configuration=$(Configuration);ReferenceType=$(ReferenceType);AbstractionsPackageVersion=$(AbstractionsPackageVersion);LoggingPackageVersion=$(LoggingPackageVersion)&quot;" />
<Exec Command="$(NuGetCmd) pack -Symbols -SymbolPackageFormat snupkg $(ToolsDir)specs\Microsoft.Data.SqlClient.nuspec -Version $(MdsPackageVersion) -OutputDirectory $(PackagesDir) -properties &quot;COMMITID=$(CommitId);Configuration=$(Configuration);ReferenceType=$(ReferenceType);AbstractionsPackageVersion=$(AbstractionsPackageVersion);LoggingPackageVersion=$(LoggingPackageVersion);SqlServerPackageVersion=$(SqlServerPackageVersion)&quot;" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some YAML pipeline files that don't use this target, and call nuget pack directly. They will need this new property added to them as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @paulmedynski - I think I've caught them all.

Refer to the SqlServer package via project or package reference
depending on our build parameters.
-->
<ItemGroup Condition="'$(ReferenceType)' == 'Project' and '$(TargetFramework)' != 'net462'">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I wonder why we don't use our SqlServer package for .NET Framework. I guess the types are included, but then why does SqlServer target net46?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea is that netstandard2.0 is the normal version (which includes the IBinarySerialize interface et al), and on net462 it simply type forwards to the full Framework - so a netstandard2.0 library which references the package will continue to work even in a netfx environment.

@github-project-automation github-project-automation bot moved this from To triage to In progress in SqlClient Board Mar 6, 2026
@paulmedynski
Copy link
Contributor

I'll trigger the pipelines once you add the SqlServer version to the several place the YAML needs it.

@paulmedynski paulmedynski added this to the 7.0.0 milestone Mar 9, 2026
@paulmedynski paulmedynski added the Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems.

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants