4

I'm attempting to set myself up with Azure Data Studio on my new M1 Mac Mini, but the SQL Server database project I'm working on refuses to build. This is the (completely useless) error I'm getting:

stdout: /Users/dumasded/.azuredatastudio/extensions/microsoft.sql-database-projects-0.13.0/BuildDirectory/Microsoft.Data.Tools.Schema.SqlTasks.targets(586,5): error MSB4181: The "SqlBuildTask" task returned false but did not log an error. [/Users/dumasded/Projects/db-project/DBProject.sqlproj]
stdout:     0 Warning(s)
stdout:     1 Error(s)

I can neither find nor remember where I got this idea but I somehow got it into my head that this has something to do with the version of the SDK I'm using - I'm currently using 6.0.100, which as far as I can tell is the only one that's arm64 compatible. Every attempt I've made to download, install and run an earlier version of the SDK on this machine has failed. If that is in fact the problem, I can't even get far enough to find out.

Just to be sure it wasn't something to do with the existing project I was trying to set up, I created a brand new one from scratch and attempted to build that. It failed with the same error. It definitely appears to be a system issue and not a project-specific one.

Is there any hope for me? Am I doomed to return to working on my crummy Lenovo Thinkpad? My breath is bated. Thanks in advance.

EDIT

I've just come across the ingenious MSBuild.Sdk.SqlProj as a potential solution to my issue, however my attempts to use it are still running up against SDK version issues:

error : The current SDK bundles target framework 'netcoreapp6.0' which is not supported by MSBuild.Sdk.SqlProj. Either install a .NET Core SDK that supports 2.1, 3.1 or 5.0, or file an issue at https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/ to add support.

This would seem to confirm my initial suspicion that this is an issue of SDK versions.

EDIT 2

Neglected to mention that I'm using Azure Data Studio with the SQL Database Projects extension, which purports to handle the DACPAC creation seamlessly and across platforms. Though that hasn't been my experience thus far.

Dumas.DED
  • 466
  • 5
  • 17
  • 1
    Sqlproj type uses the old .Net Framework, so Windows only. https://stackoverflow.com/a/62124722/1043380 – gunr2171 Dec 01 '21 at 14:36
  • I'll have to test this when i get home, but I'm sure I've built a ADS Database project on my home PC (which is running Ubuntu). Maybe I'm mistaken... Though at least that's still an x86/64 framework, not ARM. – Thom A Dec 01 '21 at 15:01
  • @gunr2171 - In another answer to that same question the user CrazyPyro refers to the MSBuild.Sdk.SqlProj which can be used cross-platform to produce DACPACs: https://stackoverflow.com/a/64346890/9182405. Clearly it's possible on a non-Windows machine. That being said, my attempts to use this have hit up against the same issue: dotnet 6 is not supported, and I can't get any earlier versions of the dotnet SDK to work on my machine. – Dumas.DED Dec 01 '21 at 15:41

1 Answers1

3

I'll be dunked. I knew there had to be a deceptively simple answer to this.

It turns out that my attempts to download, install and run an earlier version of the SDK on my machine weren't failing - they were just going into a different directory. Apparently, installing x64 SDKs on an arm64 machine results in the SDKs being created in a dedicated 'x64' subdirectory of the primary dotnet installation. This is painfully obvious to me now - the reason dotnet --list-sdks showed no trace of the earlier SDKs was that they were being installed for a completely isolated instance of dotnet. All I had to do was point the SQL Database Projects extension to that instance of dotnet and it started working:

SQL Database Projects: Net Core SDKLocation

I hope my publicly blundering my way through the maze of dotnet SDK architectures manages to help someone else. For my part I'm just so relieved I've finally gotten it to work.

Dumas.DED
  • 466
  • 5
  • 17
  • I have an existing .net4.8 sqlproj for a well established database but doesn't build on linux, works fine on windows build server. I really would rather not do the MSBuild.Sdk.SqlProj thing since it's not really Microsoft and a tech-debt time bomb. Looks like you just installed the correct sdk and it worked. Did you have to change the contents of the .sqlproj? – neoscribe Feb 21 '22 at 23:49
  • @neoscribe - I apologize, I've actually had to table this project for the past several months, so I'm working from memory here. If it serves, though, I did indeed just have to point it to the correct SDK, and I did not have to change anything in the .sqlproj itself, aside from pointing it to the correct SDK. – Dumas.DED Feb 23 '22 at 02:00
  • 1
    I can confirm it helped at least one other person, thank you! – Joe Aug 02 '22 at 23:38