【问题标题】:Cake, VS2017, .NET Core 2.0 and building SQL projectCake、VS2017、.NET Core 2.0 和构建 SQL 项目
【发布时间】:2018-07-09 05:38:14
【问题描述】:

我正在尝试构建一个 .NET Core 2.0 解决方案,它有一个空白的空 SQL Server 项目,但收到此错误:

MyDb.sqlproj(57,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.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.

如果我像这样直接调用 MSBuild,解决方案可以在 VS2017 以及命令行中正确构建: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" MySolution.sln /t:build /fl /flp:logfile=MyProjectOutput.log;verbosity=diagnostic

Cake 脚本如下所示:

Task("Build")
    .IsDependentOn("RestoreNuGetPackages")
    .IsDependentOn("SetVersion")
    .Does(() =>
{
   Information("Running DotNetCoreBuild");
    DotNetCoreBuild("../MySolution.sln", new DotNetCoreBuildSettings { 
        Configuration = configuration
   });
});

请告诉我为什么会出现该错误? 谢谢

【问题讨论】:

    标签: msbuild sqlproj


    【解决方案1】:

    Net Core 不支持 SQL 项目,因此您应该使用 MSBuild 而不是 DotNetCoreBuild。 像这样:

    Task("Build")
        .IsDependentOn("RestoreNuGetPackages")
        .IsDependentOn("SetVersion")
        .Does(() =>
    {
       Information("Running DotNetCoreBuild");
       MSBuild("../MySolution.sln",
        settings =>
          settings
            .SetConfiguration(configuration)
            .SetVerbosity(Verbosity.Minimal));          
    });
    

    【讨论】:

      猜你喜欢
      • 2018-01-31
      • 2018-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-09
      • 2018-08-21
      • 2018-12-08
      相关资源
      最近更新 更多