I have created a new SDK-style database project in VS code and am trying to add the DacFx package as a reference to it using the below basic command line (dotnet v7.0.5):
dotnet add package Microsoft.SqlServer.DacFx
and get the below error:
error: NU1202: Package Microsoft.SqlServer.DacFx 162.0.52 is not compatible with net46 (.NETFramework,Version=v4.6). Package Microsoft.SqlServer.DacFx 162.0.52 supports:
error: - net462 (.NETFramework,Version=v4.6.2)
error: - net6.0 (.NETCoreApp,Version=v6.0)
error: - netstandard2.1 (.NETStandard,Version=v2.1)
error: Package 'Microsoft.SqlServer.DacFx' is incompatible with 'all' frameworks in project 'C:\Users\zg19442\source\repos\bi-on-bi\Database\TestDacFxSdk2022\TestDacFxSdk2022.sqlproj'.
The .sqlproj file produced by the VS Code SQL extension doesn't contain any target framework element, and adding one in (e.g. netcoreapp3.1) results in the same error. There are no other files in the project so I'm not sure where it's getting the v4.6 framework from (4.8 is the latest installed). Also the --framework argument of the command doesn't seem to accept netcoreapp3.1 as a valid value.
Adding to my confusion is the fact that the GitHub page for Microsoft.Build.Sql is the DacFx repo: https://github.com/microsoft/DacFx. I think this should mean that the package is already installed, but I can't find any info on where the location might be.
Has anyone had any success referencing the DacFx library to publish a DB built in VS Code? The documentation on publish seems incomplete (the 'build and publish' section of this article: https://learn.microsoft.com/en-us/sql/azure-data-studio/extensions/sql-database-project-extension-sdk-style-projects?view=sql-server-ver16#build-and-publish bottles out before explaining how to publish). Or does anyone know how to change the target framework of a .sqlproj file so that the dotnet tool recognises it?
I'm mainly just trying to port the library and its dependencies to a build server, using PowerShell to invoke dac to do the deployment for me, but can't get to the first step