MSBuild.Sdk.SqlProj icon indicating copy to clipboard operation
MSBuild.Sdk.SqlProj copied to clipboard

MSB4019: Microsoft.Data.Tools.Schema.SqlTasks.targets was not found

Open Vikenesh opened this issue 3 years ago • 1 comments

Getting below error when we run pipeline from Gitlab for DACPAC sql project.

The imported project "C:\Program Files\dotnet\sdk\6.0.301\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\6.0.301\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" is correct, and that the file exists on disk.

I am using VS2019 this solution containing the SQLProj building successfully in local, but when we initiate CakeBuild for this solution from Git/local we are getting above error.

Vikenesh avatar Jul 13 '22 07:07 Vikenesh

@Vikenesh Based on the error message it looks like there's something wrong with the project file, since we're not using Mirosoft.Data.Tools.Schema.SqlTasks.targets at all. Would you mind sharing the contents of your .csproj?

jmezach avatar Jul 20 '22 09:07 jmezach

I have a similar issue (VS2022 Build Tools) and here's my project file. I removed all Import tasks.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Sdk Name="Microsoft.Build.Sql" Version="0.1.3-preview" />
  <PropertyGroup>
    <Name>Halny.Copilot.Sql.Database</Name>
    <DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP>
    <ModelCollation>1033, CI</ModelCollation>
    <TargetDatabaseSet>True</TargetDatabaseSet>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <TargetFrameworkProfile />
    <ProjectGuid>{b066d3d6-9a95-4d8a-b7d5-7169fd581074}</ProjectGuid>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="Properties" />
    <Folder Include="PublishProfiles" />
    <Folder Include="Users" />
  </ItemGroup>
  <ItemGroup>
    <Build Include="Users\Orleans.sql" />
  </ItemGroup>
  <ItemGroup>
    <None Include="PublishProfiles\Azure.publish.xml">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <SqlCmdVariable Include="OrleansUserPassword">
      <DefaultValue />
      <Value>$(SqlCmdVar__1)</Value>
    </SqlCmdVariable>
  </ItemGroup>
</Project>

jkonecki avatar Sep 02 '22 22:09 jkonecki

@jkonecki Based on the project file I think you're using Microsoft.Build.Sql, which is unrelated to MSBuild.Sdk.SqlProj. Have a look at this repository for more details on that.

@Vikenesh I'm assuming you're also using Microsoft.Build.Sql as we are not using the mentioned .targets file. Feel free to re-open this issue though if you are using MSBuild.Sdk.SqlProj in your project.

jmezach avatar Sep 05 '22 07:09 jmezach