SqlChangeAutomation.Data.Schema.Ssdt.targets not found when doing a build using dotnet.exe

scottw_cmscottw_cm Posts: 2 New member
edited December 5, 2018 4:52PM in SQL Change Automation
Hello team,

We're working to build a .NET Core application with SQL Change Automation. The Visual Studio development experience works great, but now that the *.sqlproj is added to the solution, we get the following error when running `dotnet build` against it:

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.500\SqlChangeAutomation\SqlChangeAutomation.Data.Schema.Ssdt.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

We are running the latest version of SCA (3.0.18331.2906).

Is support for building from dotnet.exe coming soon?

Thanks,
Scott

Edit: Removed "private" build from the title, as the issue really affects all command line builds.
Tagged:

Answers

  • Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our documentation site for detailed guides on how to use our tools
  • scottw_cmscottw_cm Posts: 2 New member
    edited December 5, 2018 4:54PM
    The above article is unrelated to the issue at hand.

    Apologies, let me clarify the repro steps:

    1) From Visual Studio, create a new .NET Core Application - doesn't matter if it's a console or web app. Give it a name and save it.

    2) Navigate to the solution folder from command prompt and execute: 

    dotnet build <solutionfile>

    The project will build successfully.

    3) From Visual Studio again, add a SQL Change Automation project to the same solution.

    4) Follow the usual steps of creating a baseline script from a test database and deploying it to a local development database. Confirm that it builds from Visual Studio with <ctrl>+B (it should build fine)

    5) Navigate to the solution folder from command prompt and execute: 

    dotnet build <solutionfile>

    Expected: The project will build successfully.

    Actual: The project build will fail with the following error:

    error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.500\SqlChangeAutomation\SqlChangeAutomation.Data.Schema.Ssdt.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    As "dotnet build" is the method to build solutions with .NET Core (instead of msbuild as on the .NET Framework), this will likewise cause the entire project to fail to build on a build server, hence the importance of supporting SCA on dotnet.exe builds. This error prevents a .NET Core project from using SQL Change Automation at all without using multiple solution files or breaking up the build into separate steps (one for each top-level project).

    Note the above repro steps are assuming .NET Core 2.1 is used, but I suspect any version of .NET Core would encounter the same issue as the tooling is different from standard .NET Framework.

    Thanks,
    Scott
  • Hi Scott,

    Sorry, I have checked with the development team and this is not possible yet.

    However we are planning to support this in a future release.

    Please keep an eye on the release notes for any announcements regarding this feature: https://documentation.red-gate.com/sca3/release-notes-and-other-versions/visual-studio-extension-release-notes

    Kind Regards,
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our documentation site for detailed guides on how to use our tools
Sign In or Register to comment.