2

我正在尝试构建一个 .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

蛋糕脚本如下所示:

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

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

4

1 回答 1

0

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));          
});
于 2019-07-19T18:38:49.190 回答