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

Created on 27 Jul 2017  路  8Comments  路  Source: dotnet/sdk

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

Most helpful comment

@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.

All 8 comments

the dotnet command only supports SDK based projects. It seems like your solution has some projects that are not support by the dotnet CLI.

I suggest you restore through msbuild /t:restore and build using msbuild /t:build. MSBuild will support all projects types.

If this does not solve your issue, please re-activate.

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.

@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.

I am also getting errors on this. Seems strange it would try to do a restore on a project type that is not supported.

@DaveSlinn @ilya-chumakov @smasherprog This issue seems pretty dead. If you want a fix, you'll probably get further by opening a new issue.

@livarcocc please, reopen this issue. dotnet restore and dotnet build still has issues with solutions which use .sqlproj projects. How are we supposed to build our solutions when .NET Core just fails the whole build?

This needs to be reevaluated.

+1

Was this page helpful?
0 / 5 - 0 ratings