蛋糕,VS2017,.NET Core 2.0和构建SQL项目



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

MyDb.sqlproj(57,3): error MSB4019: The imported project "C:Program Filesdotnetsdk2.1.4MicrosoftVisualStudiov11.0SSDTMicrosoft.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

蛋糕脚本如下所示:

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

任何想法为什么我会收到这个错误?谢谢

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));          
});

最新更新