question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to build in VS - Visual Studio support for Microsoft.Build.Sql

See original GitHub issue
  • SqlPackage or DacFx Version: 161
  • .NET Framework (Windows-only) or .NET Core: Windows
  • Environment (local platform and source/target platforms):

Steps to Reproduce:

  1. Attempt to load/build a new sqlproj based on template 0.1.7
  2. Load fails
  3. adding this enables the build:
    <TargetDatabaseSet>True</TargetDatabaseSet>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <TargetFrameworkProfile />
    <ProjectGuid>{f1ee546e-2489-4a7b-9d69-7e2849143721}</ProjectGuid>

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
dzsquaredcommented, Nov 30, 2022

Support for Microsoft.Build.Sql sqlprojects is planned for future Visual Studio (SSDT) releases. Reopening this item until it is shipped

2reactions
CSharpFiascocommented, Jan 8, 2023

I had a similar issue, and I was able to resolve this by deleting the obj folder for my project. And so, I set up the project to clean the project and to delete the obj folder before clean. It’s still a work in progress, but I landed on the code below to both build in Visual Studio 2022 and via the dotnet cli. The dotnet cli seems to build just fine without deleting the obj folder, but it wasn’t deleting the folder, so I just added ContinueOnError=“True”.

Edited code since Visual Studio 2022 didn’t seem to output the dacpac.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0">
  <Sdk Name="Microsoft.Build.Sql" Version="0.1.7-preview" />
  <PropertyGroup>
    <Name>sample</Name>
    <DSP>Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider</DSP>
    <ModelCollation>1033, CI</ModelCollation>
    <ProjectGuid>{939b2fc6-e398-4920-a5d4-7b3816c0b3a5}</ProjectGuid>
    <TargetDatabaseSet>True</TargetDatabaseSet>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="Properties" />
  </ItemGroup>
  <Target Name="PreBuild" BeforeTargets="Build">
    <Message Text="PreBuild - Starting to remove obj folder" />
    <!-- Remove obj folder -->
    <RemoveDir Directories="$(BaseIntermediateOutputPath)" Condition="Exists('$(BaseIntermediateOutputPath)')" ContinueOnError="True" />
    <Message Text="PreBuild - Finished removing obj folder" />
  </Target>
</Project>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Devops failing to build sql server database project
I have a sql database project in Visual Studio (2019). I am trying to deploy it via azure devops. The pipeline is failing...
Read more >
Not able to build Visual Studio Database Project targeting ...
We have a Visual Studio Database Project that we are trying to move to Azure SQL Database. Some of our views use AT...
Read more >
.sqlproj with Deployment Contributor fails to build on ...
I'm failing to build an SSDT (.sqlproj) project on a new build server that we plan to use for our CI/CDs. This project...
Read more >
Issues
Issue Type: Bug open a sql database project in 'database projects', right-click projectname and choose 'Build' => OUTPUT [ Build ] ...
Read more >
SSDT not present in Visual Studio Build Tools 2017
So the problem is that when you try to build the SQL Server project with Visual Studio Build Tools 2017 15.5.1, the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found