简体   繁体   English

TeamCity / .sqlproj通过MSBuild构建 - 失败

[英]TeamCity/.sqlproj build via MSBuild — FAILED

It all started with the VS2017 runner type within TC. 这一切都始于TC中的VS2017转轮类型。 It was failing without any errors or hints (except the (default targets) -- FAILED. message on the solution level). 它没有任何错误或提示失败(除了解决方案级别的(default targets) -- FAILED.消息)。 I narrowed it down to the .sqlproj'ects. 我把它缩小到了.sqlproj'ects。 These are not building via MSBuild, they do compile perfectly within VS2017 on the build agent. 这些不是通过MSBuild构建的,它们在构建代理上的VS2017中完全编译。 I was blaming SSDT for it... but I guess I checked everything. 我正在责备SSDT ......但我猜我检查了一切。 This is the problem which bubbles up to the solution level within the TC build: 这是在TC构建中达到解决方案级别的问题:

在此输入图像描述

I noticed that for VS2017 SSDT comes with the VS setup. 我注意到对于VS2017,SSDT附带了VS设置。 The "Workload" "Data storage and processing" is installed and so is "SQL Server Data Tools" under "Individual components". 安装了“工作负载”“数据存储和处理”,“单个组件”下的“SQL Server数据工具”也是如此。 I noticed on https://docs.microsoft.com/EN-US/sql/ssdt/download-sql-server-data-tools-ssdt the sentence "If you are using SSDT with Visual Studio 2017, install the AS and RS components". 我注意到https://docs.microsoft.com/EN-US/sql/ssdt/download-sql-server-data-tools-ssdt句子“如果你在Visual Studio 2017中使用SSDT,请安装AS和RS组件”。 Did it. 做到了。 Nothing changed. 没有改变。 SSDT is also installed separately for previous versions. SSDT也为以前的版本单独安装。

This stack is related but it didn't help me. 这个堆栈是相关的,但它没有帮助我。

Any other ideas? 还有其他想法吗?


I came a step further. 我走得更远了。 Beside VS the Build Tools are installed as well on the build agent and TeamCity's runner for VS2017 obviously uses MSBuild from the Build Tools. 除了VS之外,构建工具也安装在构建代理上,而TeamCity的VS2017运行器显然使用了构建工具中的MSBuild。 As you can see above I was reproducing the issue with MSBuild from the Build Tools as well. 正如您在上面所看到的,我也在使用Build Tools中的MSBuild重现了这个问题。 If I pick the MSBuild "version" of VS2017 it works like a charm (as it does right within VS). 如果我选择VS2017的MSBuild“版本”,它就像一个魅力(就像在VS中一样)。 To make it short: 简而言之:

DOES NOT WORK 什么都不行

C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin

WORKS 作品

C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\15.0\\Bin

I found a blog post from Lukie Briner , his last paragraph pointed me to the solution (thank you buddy!). 我找到了Lukie Briner的博客文章,他的最后一段向我指出了解决方案(谢谢伙计!)。

Still don't know why/how this can happen, maybe it is related to the order of the installations of Build Tools, SSDT, Visual Studio etc.? 仍然不知道为什么/如何发生这种情况,也许它与Build Tools,SSDT,Visual Studio等的安装顺序有关?

The reason: SSDT was missing in the Build Tools and its version of MSBuild. 原因是:BuildT及其版本的MSBuild中缺少SSDT。

What I have done: 我做了什么:

Copy the SSDT folder from 复制SSDT文件夹

C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\Microsoft\\VisualStudio\\v15.0

to

C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\Microsoft\\VisualStudio\\v15.0 . C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\Microsoft\\VisualStudio\\v15.0

WOW! 哇! I finally see a REAL error message : 我终于看到一条REAL错误消息

构建工具 -  MSBuild的错误消息

Now I had to copy SQLDB and SQLEditor (I think SQLCommon already existed in the destination folder, if not it should also be copied) from 现在我不得不复制SQLDBSQLEditor (我认为SQLCommon已经存在于目标文件夹中,如果不是也应该被复制)

C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Common7\\IDE\\Extensions\\Microsoft

to

C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\Common7\\IDE\\Extensions\\Microsoft

and BOOM... 和BOOM ......

成功

And yes, the VS2017 runner from TeamCity is also happy with it. 是的,来自TeamCity的VS2017赛跑者也很满意。

Seems like the issue with Build Tools and SSDT has been solved now and you don't have to mess with manual copy of targets directories anymore (Visual Studio Build Tools 2017 v15.9.8). 看起来像Build Tools和SSDT的问题现在已经解决了,你不必再乱用目标目录的手动副本了(Visual Studio Build Tools 2017 v15.9.8)。

  1. Just open the Visual Studio Installed on the build agent server 只需打开构建代理服务器上安装的Visual Studio即可
  2. Modify Build Tools installation 修改构建工具安装
  3. Select to install the "Data storage and processing tools" 选择安装“数据存储和处理工具”
  4. Modify 修改

Build should work now. 构建现在应该工作。

修改VS Build Tools

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TeamCity构建步骤-MSBuild中失败 - TeamCity build step — FAILED in MSBuild teamcity增量构建MSBuild - teamcity incremental build MSBuild Visual Studio SSDT 数据库项目 (.sqlproj) 构建 - 使用没有 MSBUILD (msbuild.exe) 的 CLI 生成.dacpac - Visual Studio SSDT Database project (.sqlproj) build - generate .dacpac using CLI without MSBUILD (msbuild.exe) 使用TeamCity进行构建:无法启动MSBuild。 请指定要使用的nuspec或项目文件 - Build using TeamCity: Failed to start MSBuild; please specify a nuspec or project file to use 通过MSBuild执行构建时,TeamCity为什么会忽略我的Web项目的打包/发布设置? - Why is TeamCity ignoring my web project's package/publish settings when executing my build via MSBuild? TeamCity:无法在MSBuild项目中检测目标 - TeamCity: Failed to detect target in MSBuild project 在TeamCity中的MSBuild中,FSharp项目构建失败 - FSharp project build fails in MSBuild in TeamCity MSBuild 中的嵌套 SQL 不会使 TeamCity 构建失败 - Nested SQL in MSBuild not failing TeamCity build Teamcity MSBuild将构建输出复制到新文件夹 - Teamcity MSBuild Copy build output to new folder TeamCity + MSBuild:使用VCS内部版本号标记部署 - TeamCity + MSBuild: Tagging a deployment with a VCS build number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM