简体   繁体   English

使用 MSBuild 构建解决方案文件夹

[英]Build a solution folder with MSBuild

we have a solution file that contains some solution folders : libraries, unit-tests, applications...我们有一个解决方案文件,其中包含一些解决方案文件夹:库、单元测试、应用程序...

With VS2010 we can build only the projects of a given folder by right-clicking on it and using "build" or "rebuild".使用VS2010 ,我们可以通过右键单击它并使用“build”或“rebuild”来仅构建给定文件夹的项目。

This is perfect on the developers' workstations, and we'd like to do the same on the continuous-integration server which uses MSBuild .这在开发人员的工作站上是完美的,我们希望在使用MSBuild的持续集成服务器上做同样的事情。

So, can we build a solution folder with MSBuild?那么,我们可以用 MSBuild 建立一个解决方案文件夹吗?

Or will we have to create a dedicated solution for each folder?还是我们必须为每个文件夹创建一个专用的解决方案?

Thanks in advance for any help.提前感谢您的帮助。

FINAL EDIT : the conclusion of the below responses is that their is no built-in way to do that but some workarounds:最终编辑:以下回复的结论是,他们没有内置的方法可以做到这一点,但有一些解决方法:

  • create a dedicated solution with only the selected projects,仅使用选定的项目创建专用解决方案
  • use a dedicated csproj that will build the selected projects,使用将构建选定项目的专用 csproj
  • add a new project which will reference the selected projects in the existing solution file.添加一个新项目,该项目将引用现有解决方案文件中的选定项目

I've chosen to use a dedicated solution file as it is the less intrusive and tricky way, though not the more flexible (the dedicated csproj solution should offer full control).我选择使用专用的解决方案文件,因为它的侵入性和技巧性更小,虽然不是更灵活(专用的 csproj 解决方案应该提供完全控制)。

Yes you can build Solutions folders using MSBUILD是的,您可以使用 MSBUILD 构建解决方案文件夹

msbuild "framework.sln" /t:First\Project:Build

Will build the Project in the Folder called First, HOWEVER disk folders and soltions folders must match (I tried it for my solution where they dont first)将在名为 First 的文件夹中构建项目,但是磁盘文件夹和解决方案文件夹必须匹配(我在他们不首先尝试的解决方案中尝试了它)

So all youd have to do is choose a project that has all the other projects in that folder as dependencies.因此,您所要做的就是选择一个项目,该项目将该文件夹中的所有其他项目作为依赖项。

Also see: http://msdn.microsoft.com/en-us/library/ms164311.aspx另请参阅: http://msdn.microsoft.com/en-us/library/ms164311.aspx

The short answer is:简短的回答是:

Yes , if you want to build specific set of projects (grouped together in a VS solution) with plain MSBuild you will have to create a dedicated MSBuild.proj for each specific set of projects you want to build.的,如果您想使用普通的 MSBuild构建特定的项目集(在 VS 解决方案中组合在一起),您将必须为要构建的每个特定项目集创建一个专用的 MSBuild.proj。

You will not have to create (and maintain) VS solutions to support your build but in the end it's the same (MSBuild.proj vs. VS solution).您不必创建(和维护)VS 解决方案来支持您的构建,但最终它是相同的(MSBuild.proj 与 VS 解决方案)。

I have a similar scenario with a set of 60+ .NET projects (.btprpj BizTalk).我有一组 60 多个 .NET 项目(.btprpj BizTalk)的类似场景。 For developing in VS these projects are currently organized in 12 VS solutions.为了在 VS 中开发,这些项目目前被组织在 12 个 VS 解决方案中。

For automated build and deploy I created a set of 50+ MSBuild.proj scripts to target every single component (or set of components) I need.对于自动构建和部署,我创建了一组 50 多个 MSBuild.proj 脚本来定位我需要的每一个组件(或一组组件)。

MSBuild offers a lot of possibilities for automating all the stuff around the actual build of the VS projects (export from VCS, etc.). MSBuild 为围绕 VS 项目的实际构建(从 VCS 导出等)自动化所有东西提供了很多可能性。

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

相关问题 msbuild 目标 - AfterTargets =“构建”解决方案? - msbuild target - AfterTargets=“Build” for the solution? msbuild - 有没有办法指定不在解决方案中构建网站 - msbuild - is there a way to specify not to build a website in a solution 使用MSBuild for Build解决方案包括InstallShield ProjecT - Using MSBuild for Build solution include InstallShield ProjecT Visual Studio工作时,MSBuild无法生成解决方案 - MSBuild cannot build a solution when Visual Studio works 使用MSBuild任务在同一解决方案中生成另一个(C ++)项目? - Using MSBuild task to build another (C++) project in the same solution? 由于软件包名称不匹配,MSBuild无法生成解决方案文件 - MSBuild does not build solution file because of mismatching package name 在CI服务器上的MSBuild中构建期间从解决方案中排除项目 - Exclude projects from solution during build in MSBuild on a CI server 停止解决方案构建第一次编译\\链接错误 - msbuild - stop solution build on first compilation\link error - msbuild 强制msbuild构建一个在解决方案配置中未选中的项目 - Force msbuild to build a project which is unselected in solution config 无法在解决方案文件上使用 msbuild 命令行调用生成目标 - Unable to invoke Build target using msbuild command line on a solution file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM