dotnet restore or dotnet build against VS2017 solution with sqlproj shows error MSB4019
See original GitHub issueSteps to reproduce
- Start VS2017.
- Create .NET Core Console app and save project/solution
- Add new SQL Server > SQL Server Database Project to solution:
- Build solution in VS - should complete without any problems.
- Run project - console app should start and run without any problems.
- Open a console and cd to folder containing the .sln and execute
dotnet restore
ordotnet 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:
- Created 6 years ago
- Reactions:3
- Comments:8 (1 by maintainers)
@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.
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.