使用 TeamCity 运行构建时出现 MSBuild 错误 MSB3202

发布于 2024-10-03 20:51:35 字数 7969 浏览 3 评论 0原文

我的任务是为我们的小型 .Net 商店研究和实施 CI。经过研究后,我们选择 TeamCity 进行自动化构建。安装 TeamCity 和 MSBuild 非常简单,但问题是我开始构建的时间。我总是会得到一个错误。从表面上看,它正在尝试调用共享库项目,因此我做的第一件事是编辑 VCS 以包含共享库,但这并没有解决问题。

请查看构建日志,并告诉我是否需要通过 TeamCity 或 VS 2008 配置 MSBuild?

[09:32:29]: Checking for changes
[09:32:31]: Clearing temporary directory: C:\Program Files\TeamCity\BuildAgent\temp\buildTmp
[09:32:31]: Checkout directory: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3
[09:32:31]: Updating sources: server side checkout... (3s)
[09:32:31]: [Updating sources: server side checkout...] Building incremental patch for VCS root: Shared Libraries
[09:32:33]: [Updating sources: server side checkout...] Building incremental patch for VCS root: My TFS Two
[09:32:35]: [Updating sources: server side checkout...] Repository sources transferred
[09:32:35]: Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build 
target(s)):
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\log4net\root\log4net.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\log4net\root\log4net.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build 
target(s)):] Project "Apollo.sln" (Rebuild target(s)):
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] Building solution configuration "Deployment|Any CPU".
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: MSBuild output:
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: Done Building Project "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln" (Rebuild target(s)) -- FAILED.
[09:32:36]: Done Building Project "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)) -- FAILED.
[09:32:36]: Build FAILED.
[09:32:36]: "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target) (1) ->
[09:32:36]: (TeamCity_Generated_Build target) ->
[09:32:36]: ..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: ..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: ..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: ..\..\..\Shared Libraries\log4net\root\log4net.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\log4net\root\log4net.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target) (1) ->
[09:32:36]: "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln" (Rebuild target) (2) ->
[09:32:36]: (Rebuild target) ->
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: 4 Warning(s)
[09:32:36]: 4 Error(s)
[09:32:36]: Time Elapsed 00:00:00.60
[09:32:36]: Publishing artifacts
[09:32:36]: [Publishing artifacts] Paths to publish: [teamcity-info.xml]
[09:32:36]: [Publishing artifacts] Publishing files
[09:32:36]: Build finished

I was given the task to research and implement CI for our small .Net shop. After doing our research, we selected TeamCity to our automated builds. Installing TeamCity and MSBuild was pretty straight forward but the issue is when I started the build. I would always get an error. From the looks of things, it's trying to call the Shared Library project so the first thing I did was edit the VCS to include the Shared Library but that did not resolve the issue.

Please review the log from the build and let me know if I need to configure MSBuild via TeamCity or on VS 2008?

[09:32:29]: Checking for changes
[09:32:31]: Clearing temporary directory: C:\Program Files\TeamCity\BuildAgent\temp\buildTmp
[09:32:31]: Checkout directory: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3
[09:32:31]: Updating sources: server side checkout... (3s)
[09:32:31]: [Updating sources: server side checkout...] Building incremental patch for VCS root: Shared Libraries
[09:32:33]: [Updating sources: server side checkout...] Building incremental patch for VCS root: My TFS Two
[09:32:35]: [Updating sources: server side checkout...] Repository sources transferred
[09:32:35]: Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build 
target(s)):
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)):] ..\..\..\Shared Libraries\log4net\root\log4net.csproj warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\log4net\root\log4net.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: [Project "Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build 
target(s)):] Project "Apollo.sln" (Rebuild target(s)):
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] Building solution configuration "Deployment|Any CPU".
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: [Project "Apollo.sln" (Rebuild target(s)):] C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln error MSB3202: The project file "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: MSBuild output:
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: Done Building Project "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln" (Rebuild target(s)) -- FAILED.
[09:32:36]: Done Building Project "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target(s)) -- FAILED.
[09:32:36]: Build FAILED.
[09:32:36]: "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target) (1) ->
[09:32:36]: (TeamCity_Generated_Build target) ->
[09:32:36]: ..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: ..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: ..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: ..\..\..\Shared Libraries\log4net\root\log4net.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\..\..\Shared Libraries\log4net\root\log4net.csproj" failed. The project file "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build target) (1) ->
[09:32:36]: "C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln" (Rebuild target) (2) ->
[09:32:36]: (Rebuild target) ->
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Local.Data\v2\Local.Data.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Local.Web\v2\Local.Web.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\log4net\root\log4net.csproj" was not found.
[09:32:36]: C:\Program Files\TeamCity\BuildAgent\work\18eca7a0915880c3\Apollo.sln : error MSB3202: The project file "..\..\..\Shared Libraries\Twitterizer\root\Twitterizer.OAuth\Twitterizer.OAuth.csproj" was not found.
[09:32:36]: 4 Warning(s)
[09:32:36]: 4 Error(s)
[09:32:36]: Time Elapsed 00:00:00.60
[09:32:36]: Publishing artifacts
[09:32:36]: [Publishing artifacts] Paths to publish: [teamcity-info.xml]
[09:32:36]: [Publishing artifacts] Publishing files
[09:32:36]: Build finished

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

慢慢从新开始 2024-10-10 20:51:35

这是一个非常简单的错误 - MSBuild 找不到您要构建的项目文件。对此有两种可能的解释:

  1. 您尚未将这些项目签入版本控制存储库
  2. 您已签入它们,但未签入 MSBuild 期望找到它们的位置。

版本控制中源文件的结构应与您在 Visual Studio 中本地构建时使用的结构相匹配。如果不这样做,您将继续遇到问题。

This is a really straightforward error - MSBuild can't find the project file you're trying to build. There are two possible explanations for that:

  1. You haven't checked those projects into your version control repository
  2. You have checked them in, but not at the location where MSBuild is expecting to find them.

The structure of your source files in version control should match the structure you're using to build locally in Visual Studio. If it doesn't you're going to continue to have problems.

离笑几人歌 2024-10-10 20:51:35

TLDR

Linux 是区分大小写的

文件系统 ->文件系统

使用不同的构建容器进行构建,我从 Windows 切换到 Linux,其中一个项目名称中的字母大小写不正确,因此找不到该文件。

TLDR

Linux is case-sensitive

Filesystem -> FileSystem

Using a different build container to build, I switched from windows to linux and the case of letters in the name in one of the projects wasn't right and therefore the file was not found.

无声静候 2024-10-10 20:51:35

问题似乎不在 MSBuild 中,而是在 TeamCity 项目配置的版本控制设置中。验证您期望的文件是否位于构建代理的 work 子目录中。将它们与您的 Visual Studio 项目和构建日志进行比较;验证路径是否正确。

您还可以在 TeamCity 开发者社区 上发布问题。

It appears that the issue is not in MSBuild but in the Version Control Settings for your TeamCity project configuration. Verify that the files you expect to be there are in the work subdirectory on the build agent. Compare those against your Visual Studio project and the build log; verify that the paths are correct.

You can also post questions on the TeamCity Developer Community.

孤云独去闲 2024-10-10 20:51:35

我注意到您的路径实际上将项目放在工作目录之外。假设这是正确的:

我收到此消息,其构建在另一个项目中完美运行,并且我验证了项目文件位于磁盘上。

唯一的区别是“版本控制设置”高级选项部分下的“签出目录”名称。事实证明,msbuild 中的路径模式匹配无法处理长路径。

我将签出目录名称更改为只有三个字母长,发现项目文件很好。

I notice that your paths actually put the projects outside of the working directory.. assuming that is correct:

I was getting this message with a build that worked perfectly in a different project, and where I verified that the project files were on disk.

The only difference was the 'Checkout directory' name under the 'Version Control Settings' advanced options section. Turns out that the path pattern matching in msbuild cant handle long paths..

I changed the checkout directory name to only be three letters long and it found the project files fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文