如何在 devenv 任务中指定多个构建类型,CruiseControl.net

发布于 2024-11-05 09:09:42 字数 565 浏览 0 评论 0原文

我想在 devenv 中进行清理和构建。我刚刚注意到 buildtype 标志只能有一项(Clean;不允许 Build)。您知道如何指定多个 BuildType 吗?

<tasks>
  <devenv>
    <solutionfile>C:\Source\Developer.sln</solutionfile>
    <configuration>Release</configuration>
    <buildtype>Build</buildtype> // How to do Clean and build here???
    <executable>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com</executable>
    <buildTimeoutSeconds>900</buildTimeoutSeconds>
  </devenv>
</tasks>

I want to do Clean and Build in devenv. I just noticed that buildtype flag can have only one item (Clean;Build not allowed). Do you have any idea how to specify multiple BuildTypes?

<tasks>
  <devenv>
    <solutionfile>C:\Source\Developer.sln</solutionfile>
    <configuration>Release</configuration>
    <buildtype>Build</buildtype> // How to do Clean and build here???
    <executable>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com</executable>
    <buildTimeoutSeconds>900</buildTimeoutSeconds>
  </devenv>
</tasks>

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

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

发布评论

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

评论(2

不再让梦枯萎 2024-11-12 09:09:42

你需要两个任务。每个 块对应于一次 devenv.com 调用。 devenv.com 的选项仅允许您进行 /Clean/Rebuild 而不是构建。如果您想先清理然后正常构建,您将需要调用 devenv.com 两次,因此您需要两个任务。

You need two tasks. Each <devenv> block corresponds to one devenv.com invocation. The options to devenv.com only allow you to /Clean or /Rebuild instead of building. If you want to clean first and then build normally you will need to invoke devenv.com twice and therefore you need two tasks.

迷迭香的记忆 2024-11-12 09:09:42

还有另一种方法可以解决这个问题,即针对项目文件调用 MSBUILD 任务;这反过来又针对解决方案文件调用 devenv ;这样做的优点是它使得集成单元测试、代码分析等想法变得更容易。

这是我的 Common.Targets 中的几个目标

<Target Name="Clean">
    <RemoveDir Directories="$(BuildFolder)" />
    <MakeDir Directories="$(BuildFolder)" Condition="!Exists('$(BuildFolder)')" />

    <MSBuild Projects="$(SolutionName).sln" Properties="ReferencePath=$(ReferencePath);Configuration=$(Configuration)" Targets="Clean" />
</Target>

<Target Name="Compile" DependsOnTargets="Version">
    <MSBuild Projects="$(SolutionName).sln" Properties="ReferencePath=$(ReferencePath);Configuration=$(Configuration);OutputPath=$(OutputPath);OutDir=$(OutputPath)\;DeployDir=$(CodeDeployFolder)\;Deploy=true;BuildConstants=$(BuildConstants)" />
</Target>

然后对于我的 CruiseControl 任务

    <msbuild>
        <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
        <workingDirectory>code</workingDirectory>
        <projectFile>Mailer.proj</projectFile>
        <targets>BuildAll;DistributeLibrary</targets>
        <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
    </msbuild>

这也使得在构建场中添加新进程变得更容易,例如,假设您想在项目中引入 StyleCop 分析,则不必更改 CC.NET 设置,只需引入/扩展 CodeAnalysis 目标并将其作为 BuildAll 的一部分

There is another way around this, which is to invoke an MSBUILD task against a project file; this in turn calls devenv against the solution file; advantage to this is it makes it easier to integrate thinks like unit test, code analysis etc.

Here's a couple of targets from my Common.Targets

<Target Name="Clean">
    <RemoveDir Directories="$(BuildFolder)" />
    <MakeDir Directories="$(BuildFolder)" Condition="!Exists('$(BuildFolder)')" />

    <MSBuild Projects="$(SolutionName).sln" Properties="ReferencePath=$(ReferencePath);Configuration=$(Configuration)" Targets="Clean" />
</Target>

<Target Name="Compile" DependsOnTargets="Version">
    <MSBuild Projects="$(SolutionName).sln" Properties="ReferencePath=$(ReferencePath);Configuration=$(Configuration);OutputPath=$(OutputPath);OutDir=$(OutputPath)\;DeployDir=$(CodeDeployFolder)\;Deploy=true;BuildConstants=$(BuildConstants)" />
</Target>

Then for the CruiseControl task I have

    <msbuild>
        <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
        <workingDirectory>code</workingDirectory>
        <projectFile>Mailer.proj</projectFile>
        <targets>BuildAll;DistributeLibrary</targets>
        <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
    </msbuild>

This also makes it easier to add new processes across your build farm, e.g. say you want to introduce StyleCop analysis into your project, you don't have to change the CC.NET settings just introduce/extend a CodeAnalysis target and make that part of BuildAll

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