在 Visual Studio Online Build Definition 中从具有多个 Web 项目的解决方案构建一个 Web 项目

2024-07-03

我面临一个问题,我需要从 Visual Studio Online 中包含两个 Web 项目的解决方案中仅构建一个 Web 项目。

  • 我还没有找到如何使用“Visual Studio 构建”步骤仅构建一个项目。

如果存在这样一种方法来通过“Visual Studio Build”步骤执行此操作,那就太好了。

  • 我还尝试使用“MSBuild”步骤。不幸的是,我在使用 Nuget 恢复包时遇到了问题。我收到错误:##[错误]找不到文件格式标头,##[错误]从工具 NuGet.exe 返回意外的退出代码 1。运行后立即:Nuget.exe 恢复 Myproj.csproj.

总结:

如何在 Visual Studio 在线构建定义中从具有多个 Web 项目的解决方案中仅构建一个 Web 项目?

Update

这是我构建时出现错误的图像。另外,我使用“Visual Studio Build”步骤或“MSBuild”步骤得到了这个。

Also

我在 VSO 问题中发现了 chrisrpatterson 的评论:https://github.com/Microsoft/vso-agent-tasks/issues/571 https://github.com/Microsoft/vso-agent-tasks/issues/571

他说:您无法对 SLN 文件以外的任何文件运行 nuget 还原。您应该取消选中该 vsbuild 任务上的恢复 nuget 包。

但我需要这些包,并且我不想将我的包文件夹推送到我的存储库中。

那么,如何在“Visual Studio 构建”步骤中恢复包并仅运行我的解决方案中的一个 Web 项目呢?


您需要选择 .proj 文件,而不是选择 .sln 文件。

Firstly, click the ellipsis button next to the Solution field. enter image description here

Then choose the .proj file you want to build. For example, the screenshot below shows that the build definition is configured to build the ClassLibrary1 project, instead of the whole solution (contains ClassLibrary1 and ClassLibrary4 project)enter image description here

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Visual Studio Online Build Definition 中从具有多个 Web 项目的解决方案构建一个 Web 项目 的相关文章

随机推荐