Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can´t build .net core project with a database project. Error MSB4019

I have a new .net Core 2.0 Web API project (In Visual Studio 2017 Version 15.3.5) where I can´t build the solution if I add a new database project.

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

I have tried all kinds of solutions

  • Installed almost everything missing from the Visual Studio Installer
  • Installed Visual Studio Build Tools 2017
  • Repaired Visual Studio
  • Without luck I tried to find Microsoft.Data.Tools.Schema.SqlTasks.targets file on C:\ to the add reference to it in the project file (I then don´t know if that works while building the solution in VSTS).

So why can I add a database project to a normal API project and everything works just fine but not to a .net core one?

Do database projects not work with .net Core? I have searched for information on this but sorry I just can´t find it.

I´m not sure what to do. Hope somebody can help.

like image 546
Sturla Avatar asked Oct 18 '22 05:10

Sturla


1 Answers

Ok I managed to find the Microsoft.Data.Tools.Schema.SqlTasks.targets file on my computer.

I then needed to unload the project and edit it

There I changed this line

<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>

to the hardcoded path of my file

<SSDTExists Condition="Exists('C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>

And now it builds on my computer and on VSTS.

But why this is like this I don´t know.

like image 95
Sturla Avatar answered Oct 21 '22 09:10

Sturla