このページでは、MSBuild 実行可能ファイルを使用する Bamboo タスクの設定方法を説明します。

 

MSBuild ビルドのコード カバレッジ収集には Clover を使用できません。Clover は Ant、Maven、Grails などの Java/Groovy ベースのプロジェクトのビルダーのみをサポートしているためです。

 

MSBuild タスクを設定する方法は次のとおりです。

  1. ジョブのタスク設定タブに移動します(新しいプランを作成するとデフォルト ジョブとなります)。
  2. 目的の MSBuild タスクの名前をクリックするか、新しくタスクを作成する場合は、タスクの追加をクリックし、MSBuild をクリックします。
  3. Complete the following settings:

    MSBuild 構成
    タスクの説明A description of the task, which is displayed in Bamboo.
    実行可能ファイル

    タスクの実行に利用可能な MSBuild 実行可能ファイル。選択した実行可能ファイルは、タスク(またはジョブなど)の要件の1つとなります。

    You can add other executables, if required.

    プロジェクト ファイル
    The name of the solution, project file or MSBuild project to execute, for example ExampleSolution.sln. You can include variables (see Bamboo variables).
    オプション

    含める MSBuild のコマンド ライン オプション。 

    By default, Bamboo 5.7 (and later versions) writes the contents of the Projects File and Options fields to an MSBuild response file. See below for more information.

    You can include variables (see Bamboo variables).

  4. 必要に応じて、環境変数と作業ディレクトリの設定を指定します。

    環境変数

    (Optional)  Additional system environment variables that you want to pass to your build. Note that existing environment variables are automatically available to the executable. You can also include Bamboo global or build-specific variables (see Bamboo variables).
    Multiple variables should be separated with spaces. Parameters with spaces must be quoted (e.g ANT_OPTS="-Xms200m -Xmx700m").

    Working Sub Directory(オプション)  Bamboo が実行ファイルを実行する、ジョブのルート ディレクトリに相対的な代替サブディレクトリ。ルート ディレクトリには、ジョブの構成済みソース リポジトリから確認されたものがすべて含まれます。このフィールドを空白のまま残した場合、Bamboo はルート ディレクトリでビルド ファイルを検索します。このオプションは、サブディレクトリ内にビルド スクリプトがあり、実行可能ファイルをそのサブディレクトリ内から実行する必要がある場合に便利です。
    Powershell スクリプトとして実行(オプション、Windows のみ).bat ファイルを解釈する cmd.exe ではなく Powershell でスクリプトを実行するには、「Powershell スクリプトとして実行」チェックボックスをチェックします。インライン エディタは Powershell 構文をサポートします。
  5. 保存をクリックします。

MSBuild にオプションを渡す

By default, Bamboo 5.7 (and later versions) writes the contents of the Projects File and Options fields to an MSBuild response file:

# MSBuild response file generated by Atlassian Bamboo
%CONTENTS_OF_OPTIONS_FIELD%
%CONTENTS_OF_PROJECTS_FILE_FIELD%

そして以下のコマンドを実行します。

msbuild.exe @<full-path-to-response-file>response-file.rsp

これによって、コマンド ラインで MSBuild を呼び出すときに使用するものと同じ設定を Bamboo MSBuild で使用することができます。

You can disable creation of the response file. In that case, Bamboo will create a .bat file instead:

"<full-path-to-msbuild>msbuild.exe" %CONTENTS_OF_OPTIONS_FIELD% %CONTENTS_OF_PROJECTS_FILE_FIELD%

and run that.

To disable use of the MSBuild response file, set the bamboo.plugin.dotnet.msbuild.useResponseFile system property to false.

There are a couple of ways to do that:

  • If you start the Bamboo server or remote agents manually you can set the property on the command line, as an argument to the JVM, like this:

    -Dbamboo.plugin.dotnet.msbuild.useResponseFile=false

    Do this on all Bamboo agents, and on the Bamboo server if you use local agents.

  • If your agents are run as a service, set the system property in the <Bamboo agent home directory>/conf/wrapper.conf configuration file, like this:

    # The Bamboo Agent home configuration file
    wrapper.java.additional.1=-Dbamboo.home=/home/bamboo/bamboo-agent-home
    wrapper.java.additional.2=-Dbamboo.agent.ignoreServerCertName=false
    wrapper.java.additional.3=-Dbamboo.plugin.dotnet.msbuild.useResponseFile=true
  • If your Bamboo server runs as a service, add the system property to the <Bamboo home directory>/conf/wrapper.conf  configuration file.