microsoft / DacFx

SQL Server database schema validation, deployment, and upgrade runtime. Enables declarative database development and database portability across SQL Server versions and environments.
https://aka.ms/sqlpackage-ref
MIT License
292 stars 15 forks source link

Invalid value for the "SqlTarget" parameter of the "SqlBuildTask" task. #409

Closed greg84 closed 4 months ago

greg84 commented 4 months ago

Steps to Reproduce:

  1. Added the following line inside <Project> in my sqlproj file:

<Sdk Name="Microsoft.Build.Sql" Version="0.1.14-preview" />

  1. Run dotnet build from the folder containing the sqlproj file.

Build fails with this error:

C:\Users\me.nuget\packages\microsoft.build.sql\0.1.14-preview\tools\netstandard2.1\Microsoft.Data.Tools.Schema.SqlTasks.targets(546,7): error MSB4094: "D:\myproject\bin\Debug\mydatabase.dacpac;D:\myproject\bin\Debug\mydatabase.dacpac" is an invalid value for the "SqlTarget" parameter of the "SqlBuildTask" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem". [D:\myproject\bin\Debug\mydatabase.sqlproj]

ErikEJ commented 4 months ago

@greg84 Maybe you could share your .sqlproj file?

greg84 commented 4 months ago

Fixed it by removing this line:

<Import Project="Microsoft.Data.Tools.Schema.SqlTasks.targets" />

Sorry, closing this ticket.

dzsquared commented 4 months ago

Thanks @greg84! You got it - removing the reference to those targets. The Microsoft.Data.Tools.Schema.SqlTasks item correlates to the previous SQL project format, the targets necessary for Microsoft.Build.Sql are automatically included for all platforms.