March 18, 2026 at 9:43 pm
Hi all,
I just started using VS Code to work with DB projects. I have a work-in-progress DB, meaning some of the objects are broken. But, for those that are not broken, when I run
dotnet build
I get many unresolved reference errors that have no problem existing on the server or in SSMS. The first few objects on the list are views, which almost all use table aliases. Looking through the scripts, all use Schema.Table references. A few tables do not have red underlines, but most do. Some of these views also use CTEs, not sure if that makes any difference, though.
I created this project as new, then added a database reference directly to our Server.DB. I would like to understand why this happens and what I can do to mitigate or prevent it. I would show some examples, but that's forbidden.
I also noticed in the msbuild.log file things like this:
The "DefaultSdkResolver" resolver attempted to resolve the SDK "Microsoft.Build.Sql/2.1.0".
Warnings: null
Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Build.Sql" because directory "C:\Program Files\dotnet\sdk\8.0.419\Sdks\Microsoft.Build.Sql\Sdk" did not exist.
The "Microsoft.DotNet.MSBuildWorkloadSdkResolver" resolver attempted to resolve the SDK "Microsoft.Build.Sql/2.1.0". Warnings: null
Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadAutoImportPropsLocator" because directory "C:\Program Files\dotnet\sdk\8.0.419\Sdks\Microsoft.NET.SDK.WorkloadAutoImportPropsLocator\Sdk" did not exist.
The SDK "Microsoft.NET.SDK.WorkloadAutoImportPropsLocator" was successfully resolved by the "Microsoft.DotNet.MSBuildWorkloadSdkResolver" resolver to location "null" and version "null".
I am not quite sure how to fix those, either. Could they be contributing to the unresolved SQL reference errors?
Advice?
Thanks!
March 20, 2026 at 4:39 pm
Running the template build yields:
Running the template build: Microsoft.Build.Sql.Templates.2.1.0.nupkg already exists.
Running dotnet new sqlproj yields:
No templates or subcommands found matching: 'slqproj'.
Did you mean one of the following templates?
dotnet new sqlproj
To list installed templates similar to 'slqproj', run:
dotnet new list slqproj
To search for the templates on NuGet.org, run:
dotnet new search slqproj
For details on the exit code, refer to https://aka.ms/templating-exit-codes#103
Was there an intent to create a new project?
March 20, 2026 at 4:53 pm
Found This:
Here’s the real cause of your error and the exact fix path, based on the latest information from Microsoft and GitHub.
Your issue is not your machine — it’s a broken release of Microsoft.Build.Sql 2.1.0 that does not ship the required SDK folders, so MSBuild cannot resolve it. This is confirmed by Microsoft and multiple developers.
?? Why This Error Happens
The SDK resolver is looking for:
C:\Program Files\dotnet\sdk\8.0.419\Sdks\Microsoft.Build.Sql\Sdk
C:\Program Files\dotnet\sdk\8.0.419\Sdks\Microsoft.NET.SDK.WorkloadAutoImportPropsLocator\Sdk
…but Microsoft.Build.Sql 2.1.0 does NOT include these folders, so MSBuild fails with:
MSB4276: Could not resolve SDK "Microsoft.Build.Sql"
WorkloadAutoImportPropsLocator resolved to null
This is a known bug in the 2.1.0 GA release.
Developers confirmed that 2.1.0-preview.3 works, but 2.1.0 GA fails.
Edit your .sqlproj and change:
<Sdk Name="Microsoft.Build.Sql" Version="2.1.0" />
to:
<Sdk Name="Microsoft.Build.Sql" Version="2.1.0-preview.3" />
Then run:
dotnet restore
dotnet build
This resolves the missing SDK folder issue immediately.
March 28, 2026 at 5:44 am
This was removed by the editor as SPAM
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply