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.

dotnet restore or dotnet build against VS2017 solution with sqlproj shows error MSB4019

See original GitHub issue

Steps to reproduce

  1. Start VS2017.
  2. Create .NET Core Console app and save project/solution
  3. Add new SQL Server > SQL Server Database Project to solution: image
  4. Build solution in VS - should complete without any problems.
  5. Run project - console app should start and run without any problems.
  6. Open a console and cd to folder containing the .sln and execute dotnet restore or dotnet build

Expected behavior

CLI should restore NuGet packages as expected without any errors

Actual behavior

Console shows error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.4\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

The SqlTasks.target identified file is actually located at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\SSDT. Why is it the dotnet sdk path? Does it have something to do with an environment or project variable? Here is the relevant section from the .sqlproj:

  <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)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
    <VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
  </PropertyGroup>
  <Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
  <Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />

Environment data

.NET Command Line Tools (1.0.4)

Product Information: Version: 1.0.4 Commit SHA-1 hash: af1e6684fd

Runtime Environment: OS Name: Windows OS Version: 10.0.15063 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

20reactions
ilya-chumakovcommented, Dec 2, 2017

@livarcocc that means the whole linux-based CI chain would be broken if a SQL server project just was included into the solution.

I propose to re-open the issue if there is no workaround except installing MSBuild on Linux.

15reactions
DaveSlinncommented, Jul 31, 2017

That’s fine that it only supports SDK based projects, but when scanning a solution file (.sln) or folders for projects (.csproj, .sqlproj), why doesn’t it just skip non-SDK based projects instead of throwing an error. It’s not breaking my build process, but it is logging it and I’ve had to teach the devs on my team to simply ignore it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can´t build .net core project with a database project. Error ...
error MSB4019 : The imported project "C:\Program Files\dotnet\sdk\2.0.0\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.
Read more >
NETSDK1045: The current .NET SDK does not support ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >
dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >
net core 2.1 build fails after adding a database project
dotnet restore. C:\projects\comingsoon\ComsingSoonDatabase\ComsingSoonDatabase.sqlproj(57,3): error MSB4019: The imported project ...
Read more >
Migrating to VS2017 project causes restore error NU1105
I have an identical issue. My solution includes a test project that references an ASP.NET Core web application using BundlerMinifier.Core.
Read more >

github_iconTop Related Medium Post

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