使用MSBuild在VS2017中构建SSDT项目失败 [英] Using MSBuild to build SSDT projects with VS2017 fails

查看:358
本文介绍了使用MSBuild在VS2017中构建SSDT项目失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows Server 2016服务器上设置.sqlproj SSDT项目的持续集成.

I am trying to set up continuous integration of .sqlproj SSDT projects on our windows server 2016 server.

为此,我已在服务器上安装了VS2017和SSDT工具,以获取所需的工具.我还安装了MS构建工具2017.

In order to do this I have installed VS2017 and SSDT tools onto the server to get the required tools. I have also installed MS build tools 2017.

我目前遇到的问题是有关已安装的ms生成工具和ssdt的版本看起来不匹配的问题.

The issue I am currently having is regarding what looks to be miss-matched versions of installed ms build tools and ssdt.

我用来运行构建的命令如下:

The command i am using to run the build is as follows:

C:\\Windows\Microsoft.NET\\Framework64\\v4.0.30319\\MSBuild.exe /p:VisualStudioVersion=15.0 /property:MSBuildExtensionsPath="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\" /property:VsInstallRoot="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\" DPAP-SQL-Slim.sln

那里传递的两个开关用于设置两个环境参数,当通过Visual Studio运行时,.sqlproj文件期望找到这些环境参数.这样做是因为MSBuild默认情况下不提供它们.

The two switches passed there are to set two environment parameters that the .sqlproj file is expecting to find when run through Visual studio. This is done because MSBuild does not supply them by default.

我当前遇到的错误如下:

The error i am currently getting is as follows:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(477,5): error MSB4062: The "SqlModelResolutionTask" task could not be loaded from the assembly C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Common7\IDE\Extensions\Microsoft\SQLDB\Dac\140\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

现在,我可以从运行命令:gacutil /l的VS2017命令提示符中看到,显然Microsoft.Build.Utilities.Core dll的安装版本为v14:Microsoft.Build.Conversion.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

Now, i can see from running the command: gacutil /l in the VS2017 command prompt that the apparently installed version of the Microsoft.Build.Utilities.Core dll is v14: Microsoft.Build.Conversion.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

我在这里缺少钥匙吗?似乎安装构建工具2017并不会实际上更新GAC并注册正确的DLL.

Am i missing something key here? It appears that installing build tools 2017 did not in-fact update the GAC and register the correct DLLs.

推荐答案

请勿使用.NET Framework(C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe)中包含的msbuild.exe.它很旧,并且不支持较新的msbuild版本的某些功能.

Do not use the msbuild.exe included in .NET Framework (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe). It is old and does not support some features of newer msbuild versions.

始终使用随Visual Studio或构建工具一起安装的MSBuild版本.根据安装的VS版本,可能是

Always use the version of MSBuild installed with visual studio or the build tools. Depending on the version of VS installed, this could be

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe

从VS 2017开始,MSBuild也未在系统范围内安装,但是可以并行安装许多版本(例如VS 2017预览版,不同版本,例如Build Tools/Enterprise/Community等),这就是为什么您不会在GAC中找到这些MSBuild程序集.

Starting in VS 2017, MSBuild is also not installed system-wide but many versions (e.g. VS 2017 preview versions, different editions like Build Tools / Enterprise / Community etc.) can be installed side-by-side, which is why you won't find these MSBuild assemblies in the GAC.

这篇关于使用MSBuild在VS2017中构建SSDT项目失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆