使用Visual Studio Online Build Definition中的多个Web项目从解决方案中构建一个Web项目 [英] Build one web project from a Solution with multiple web projects in Visual Studio Online Build Definition

查看:60
本文介绍了使用Visual Studio Online Build Definition中的多个Web项目从解决方案中构建一个Web项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临一个问题,我只需要从Visual Studio Online中具有两个Web项目的解决方案中构建一个Web项目即可.

I'm facing a problem where I need to build only one web project from a solution with two web projects in Visual Studio Online.

  • 我还没有找到如何使用"Visual Studio构建"步骤仅构建一个项目的方法.

如果存在通过"Visual Studio Build"步骤执行此操作的方法,那就太好了.

It would be great if exist such a way to do this with "Visual Studio Build" step.

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

总结:

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

How can I build only one web project from a solution with multiple web projects in visual studio online build definition?

这是我构建时出现的错误图像.另外,我正在使用"Visual Studio构建"步骤或"MSBuild"步骤来获取此信息.

Here is an image of the error when I'm building. Also i'm getting this using "Visual Studio Build" step or "MSBuild" step.

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

I found a comment from chrisrpatterson in a VSO issue: https://github.com/Microsoft/vso-agent-tasks/issues/571

他说:除了SLN文件外,您不能对任何其他文件运行nuget restore.您应该取消选中该vsbuild任务上的restore nuget软件包.

但是我需要这些软件包,并且我不想将我的packages文件夹推送到我的仓库中.

But I need the packages, and I don't want to push my packages folder into my repo.

那么,如何在"Visual Studio构建"步骤中从我的解决方案中还原软件包并仅运行一个Web项目?

So, how can I restore the packages and run only one web project from my solution in "Visual Studio Build" step?

推荐答案

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

Instead of choosing the .sln file, you need to select the .proj file.

首先,单击解决方案"字段旁边的省略号按钮.

Firstly, click the ellipsis button next to the Solution field.

然后选择要构建的.proj文件.例如,下面的屏幕快照显示,已将构建定义配置为构建ClassLibrary1项目,而不是整个解决方案(包含ClassLibrary1和ClassLibrary4项目)

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)

这篇关于使用Visual Studio Online Build Definition中的多个Web项目从解决方案中构建一个Web项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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