Unable to use NetCoreBuild in .sqlproj
See original GitHub issue- SqlPackage or DacFx Version:
- .NET Framework (Windows-only) or .NET Core:
- Environment (local platform and source/target platforms):
Steps to Reproduce:
Convert a VS .sqplproj to SDK build.
Follow this from the readme (adding it to the first “PropertyGroup”)
In Visual Studio, .NET Core targets can be used by default. Add this property to the sqlproj:
<NetCoreBuild>True</NetCoreBuild>
Excpected: project builds
Actual:
Severity Code Description Project File Line Suppression State Error Your project file doesn’t list ‘win’ as a “RuntimeIdentifier”. You should add ‘win’ to the “RuntimeIdentifiers” property in your project file and then re-run NuGet restore. Database C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\NuGet\17.0\Microsoft.NuGet.targets 198
After manually deleting the bin and obj folders, I now get this error:
Severity Code Description Project File Line Suppression State Error 04062: The “SqlModelResolutionTask” task could not be loaded from the assembly C:\Users\Erik.nuget\packages\microsoft.build.sql\0.1.3-preview\Sdk..\tools\netstandard2.1\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly ‘netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. Database C:\Users\Erik.nuget\packages\microsoft.build.sql\0.1.3-preview\tools\netstandard2.1\Microsoft.Data.Tools.Schema.SqlTasks.targets 443
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
Unfortunately,
dotnet build
doesn’t work for me without specifying-p:NetCoreBuild=true
as an argument. It fails witherror MSB4019
. Long story short, in my project, I don’t have the ability to add that argument todotnet build
and it needs to be embedded in the sqlproj file. Adding those conditions to that property allows me to use both VS anddotnet build
without having to add that argument.@ErikEJ I was able to add the following properties into my sqlproj file to build both in VS as well as dotnet cli. Haven’t tried SSDT:
I haven’t tested extensively, so YMMV.