SQL project won't build after switching from Visual Studio 2022 to Visual Studio 2026
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 460
- Forks
- 29
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 7
Description
- SqlPackage or DacFx Version: Microsoft.Build.Sql v2.0.0
- .NET Framework (Windows-only) or .NET Core: .NET 9.0
- Environment (local platform and source/target platforms): Windows 11
When I switched from VS2022 to VS2026 my build suddenly started failing with this exception:
14>C:\packages\microsoft.build.sql\2.0.0\tools\net8.0\Microsoft.Data.Tools.Schema.SqlTasks.targets(473,5): Error: MSB4061: The "Microsoft.Data.Tools.Schema.Tasks.Sql.SqlModelResolutionTask" task could not be instantiated from "C:\packages\microsoft.build.sql\2.0.0\tools\net8.0\Microsoft.Data.Tools.Schema.Tasks.Sql.dll".
14>System.IO.FileNotFoundException->Microsoft.Build.Framework.BuildException.GenericBuildTransferredException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
14>C:\packages\microsoft.build.sql\2.0.0\tools\net8.0\Microsoft.Data.Tools.Schema.SqlTasks.targets(474,7): Error: MSB4027: The "SqlModelResolutionTask" task generated invalid items from the "Include" output parameter. This object is no longer valid because the MetadataLoadContext that created it has been disposed.
14>Done building project "PROJECT.sqlproj" -- FAILED.
Steps to Reproduce:
- Open existing sdk-style SQL project in VS2026 and try to build.
Did this occur in prior versions? If not - which version(s) did it work in?
The project successfully builds and outputs a .dacpac file when using both dotnet build and building via VS2022.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the build in VS2026, then compare it with the reported successful dotnet build and VS2022 build. Read Microsoft.Data.Tools.Schema.SqlTasks.targets around lines 473-474 and inspect the SqlModelResolutionTask assembly loading failure. Done means the existing sdk-style SQL project builds in VS2026 and produces its .dacpac without these errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- build-system, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100