I’m currently working on a .NET(dotnet 6) project. It includes a .sqlproj file for database schema management.
problem faced:
When trying to build the project with the .sqlproj file on macOS, I encounter build errors related to missing SSDT (SQL Server Data Tools) references. The error occurs because .sqlproj projects rely on SSDT, which isn’t supported natively on macOS.
Steps Taken:
Attempted to remove SSDT references, but it caused further build errors, making the project unmanageable.
Would consider using Docker to run SQL Server, but this approach seemed too complex and I don’t understand how it would help.
Additional Information
Using Visual Studio for Mac 2022.
Attempted to use Azure Data Studio for managing database schemas.
this is how the .sqlproj file looks like
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Name>DemoProject.Database</Name>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>4.1</ProjectVersion>
<ProjectGuid>{00000000-0000-0000-0000-000000000000}</ProjectGuid>
<DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP>
<OutputType>Database</OutputType>
<RootPath></RootPath>
<RootNamespace>DemoProject.Database</RootNamespace>
<AssemblyName>DemoProject.Database</AssemblyName>
<ModelCollation>1033, CI</ModelCollation>
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
<DeployToDatabase>True</DeployToDatabase>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetLanguage>CS</TargetLanguage>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SqlServerVerification>False</SqlServerVerification>
<IncludeCompositeObjects>True</IncludeCompositeObjects>
<TargetDatabaseSet>True</TargetDatabaseSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>binRelease</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>binDebug</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)MicrosoftVisualStudiov$(VisualStudioVersion)SSDTMicrosoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
</PropertyGroup>
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)Microsoft.Data.Tools.Schema.SqlTasks.targets" />
<Import Condition="'$(NetCoreBuild)' != 'true' AND '$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)MicrosoftVisualStudiov$(VisualStudioVersion)SSDTMicrosoft.Data.Tools.Schema.SqlTasks.targets" />
<ItemGroup>
<Folder Include="Properties" />
<Folder Include="tables" />
<Folder Include="storedprocedures" />
</ItemGroup>
<!-- tables and stored procedures -->
</Project>
Anybody ever run into this problem, would really appreciate any help?
**this the error im encountering while im building my project (src.sln) file in the package console **
/Users/username/Documents/projectPath/src/Persistence/DemoProject.Database/DemoProject.Database.sqlproj : warning NU1503: Skipping restore for project ‘/Users/username/Documents/projectPath/src/Persistence/DemoProject.Database/DemoProject.Database.sqlproj’. The project file may be invalid or missing targets required for restore. [/Users/username/Documents/projectPath/src/src.sln]
/Users/username/Documents/projectPath/src/Persistence/DemoProject.Database/DemoProject.Database.sqlproj(56,3): error MSB4019: The imported project “/usr/local/share/dotnet/sdk/7.0.317/Microsoft/VisualStudio/v17.0/SSDT/Microsoft.Data.Tools.Schema.SqlTasks.targets” was not found. Confirm that the expression in the Import declaration “/usr/local/share/dotnet/sdk/7.0.317//Microsoft/VisualStudio/v17.0/SSDT/Microsoft.Data.Tools.Schema.SqlTasks.targets” is correct, and that the file exists on disk.
user26519071 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.