在 Visual Studio 2008 中同时构建多个解决方案的最简单方法

发布于 2024-12-18 11:07:09 字数 139 浏览 1 评论 0原文

有没有一种简单直接的方法可以批量构建多个 VS2008 解决方案?我想一次构建超过 50 个作为发布版本,也许也作为调试版本。

仅在命令行上使用 MSBuild 的问题在于,很难找出哪些解决方案/项目无法构建,而这些信息至关重要。有人有好的建议吗?

Is there a simple and straightforward way to build many VS2008 solutions in a batch? I would like to build over 50 at once as Release, and perhaps also as Debug builds.

The trouble with just using MSBuild on the command line is that it is very difficult to find out which solutions/projects failed to build, information which is essential. Does anyone have a good suggestion?

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

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

发布评论

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

评论(3

七堇年 2024-12-25 11:07:09

您可以使用 MSBuild 脚本构建所有解决方案,并为仅错误或警告或完整诊断日志指定不同的日志文件。您最多可以使用十个文件记录器。

定义用于构建解决方案的 MSBuild 脚本。将所有解决方案文件添加到 ProjectToBuild 项集合中:

 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <ProjectToBuild Include="a1.sln…">
            <Properties>Configuration=Debug</Properties>
        </ProjectToBuild>
        <ProjectToBuild Include="a2.sln">
            <Properties>Configuration=Release</Properties>
        </ProjectToBuild>
    </ItemGroup>
    <Target Name="Build">
        <MSBuild Projects="@(ProjectToBuild)"/>
    </Target>
</Project>

使用 /flp MSBuild 命令行参数 为错误、警告和完整诊断日志指定不同的日志文件。

msbuild.exe ScriptAbove.proj /filelogger /flp1:logfile=errors.txt;errorsonly /flp2:logfile=warnings.txt;warningsonly /flp3:LogFile=FullDiagnostic.log;Verbosity=diagnostic

You can build all solutions using MSBuild script and specify different log files for errors or warnings only or full diagnostic log. You can use up to ten file loggers.

Define MSBuild script for building your solutions. Add all your solution files in ProjectToBuild item collection:

 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <ProjectToBuild Include="a1.sln…">
            <Properties>Configuration=Debug</Properties>
        </ProjectToBuild>
        <ProjectToBuild Include="a2.sln">
            <Properties>Configuration=Release</Properties>
        </ProjectToBuild>
    </ItemGroup>
    <Target Name="Build">
        <MSBuild Projects="@(ProjectToBuild)"/>
    </Target>
</Project>

Use /flp MSBuild command line argument to specify different log files for errors, warning, and full diagnostic log.

msbuild.exe ScriptAbove.proj /filelogger /flp1:logfile=errors.txt;errorsonly /flp2:logfile=warnings.txt;warningsonly /flp3:LogFile=FullDiagnostic.log;Verbosity=diagnostic
凯凯我们等你回来 2024-12-25 11:07:09

您可以从批处理文件中调用 devenv (Visual Studio) 来构建您的项目,例如:

  devenv projectfile /rebuild release /out logfile

这将安静地运行,而不显示 IDE。日志文件将接收您通常在 VS-IDE 构建的输出窗口中看到的消息。

如果构建正常,则返回码为 0,否则为 1。

这里是所有 devenv 命令行开关的列表

You can call devenv (Visual Studio) from a batch file to build your project, for instance:

  devenv projectfile /rebuild release /out logfile

This will run quietly without showing the IDE. The logfile will receive the messages you normally see in the output window building from within the VS-IDE.

Returncode is 0 if the build is ok, otherwise 1.

Here is a list of all devenv command line switches

朱染 2024-12-25 11:07:09

您可以为批处理文件中的每个解决方案调用 MSBuild,将输出重定向到文件,以便您可以看到失败的内容。

You can call MSBuild for each solution in a batch file, redirecting the output to a file, so you can see what failed.

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