[英]Build one web project from a Solution with multiple web projects in Visual Studio Online Build Definition
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 Online 中包含两个 Web 项目的解决方案构建一个 Web 项目。
It would be great if exist such a way to do this with "Visual Studio Build" step.如果存在这样一种使用“Visual Studio Build”步骤执行此操作的方法,那就太好了。
Summarizing:总结:
How can I build only one web project from a solution with multiple web projects in visual studio online build definition?如何在 Visual Studio 在线构建定义中从具有多个 Web 项目的解决方案中仅构建一个 Web 项目?
Here is an image of the error when I'm building.这是我构建时的错误图像。 Also i'm getting this using "Visual Studio Build" step or "MSBuild" step.
此外,我使用“Visual Studio Build”步骤或“MSBuild”步骤来获取此信息。
I found a comment from chrisrpatterson in a VSO issue: https://github.com/Microsoft/vso-agent-tasks/issues/571我在 VSO 问题中找到了 chrisrpatterson 的评论: https : //github.com/Microsoft/vso-agent-tasks/issues/571
Which he says: You can't run nuget restore against anything other than an SLN file.他说:你不能对 SLN 文件以外的任何东西运行 nuget restore。 You should uncheck restore nuget packages on that vsbuild task.
您应该取消选中该 vsbuild 任务上的还原 nuget 包。
But I need the packages, and I don't want to push my packages folder into my repo.但是我需要这些包,而且我不想将我的包文件夹推送到我的仓库中。
So, how can I restore the packages and run only one web project from my solution in "Visual Studio Build" step?那么,如何在“Visual Studio Build”步骤中从我的解决方案中恢复包并仅运行一个 Web 项目?
Instead of choosing the .sln file, you need to select the .proj file.您需要选择 .proj 文件,而不是选择 .sln 文件。
Firstly, click the ellipsis button next to the Solution field.首先,单击“解决方案”字段旁边的省略号按钮。
Then choose the .proj file you want to build.然后选择要构建的 .proj 文件。 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)
例如,下面的截图显示构建定义被配置为构建 ClassLibrary1 项目,而不是整个解决方案(包含 ClassLibrary1 和 ClassLibrary4 项目)
您可以将新的“Azure 应用服务部署”任务添加到您的构建定义,并将“包或文件夹字段”设置为“$(build.artifactstagingdirectory)**\\YOURPROJECT.zip”
You may want to create a solution with just the web project that you want to build.您可能只想使用要构建的 Web 项目创建解决方案。
In visual studio you can create a new project, and in that dialog select "other project types\\solution".在 Visual Studio 中,您可以创建一个新项目,然后在该对话框中选择“其他项目类型\\解决方案”。
The new solution can sit right next to the existing one..新解决方案可以紧邻现有解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.