1

私はビルドプロセスがNAntにあり、次の構造に似ています(多くは省略されています)。NAntスクリプトからワークフローに何を入れることができるか、そして何をMSBuildに変換する必要があるか(または変換しないか)について、混乱が生じています。NAntスクリプト内のさまざまなターゲットは、プロパティの設定、ファイルのコピー、ファイルの削除、VB6プロジェクトのコンパイルなどの外部プロセスの呼び出しを行います。これをワークフローに移植するためのヒントをいただければ幸いです。ご不明な点がございましたらお知らせください。

<?xml ... >
<project ...>

  <!-- Get and combine paths -->
  <properties name="" value=""/>
  <properties name="" value=""/>
  <properties name="" value=""/>
  .
  .
  .
  . 

  <target name="Main">
   <!--Set Log Folder Name to include date and time.
   <mkdir dir="${LogDir}"/>

   <call target="DeleteTicketsFile"/> 
   <call target="GetTickets"/> 
   <call target="WriteTicketsToFile"/> 
   <call target="WriteProperties"/> 
   <call target="DeleteFolders" failonerror="true"/> 
   <call target="GetLatest" failonerror="true"/>
   <call target="BuildDOTNETSolution" failonerror="true"/>
   <call target="BuildVB6Projects" failonerror="true"/>
   . 
   .
   .
  <target name="BuildDOTNETSolution">

    <property name="ProjectName" value="Localcache" />

    <echo message="VCVarsAllBatFile = ${VCVarsAllBatFile}"/>
    <exec program="${VCVarsAllBatFile}"/>

    <property name="dotnetSlnFile" value="${path::combine(ProductDir, 'dot.net.sln')}"/>
    <property name="dotnetOutFile" value="${path::combine(LogDir, 'dotnet.out.txt')}"/>

    <echo message="dotnetSlnFile = ${dotnetSlnFile}"/>
    <echo message="dotnetOutFile = ${dotnetOutFile}"/>

    <delete file="${dotnetOutFile}" if="${file::exists(dotnetOutFile)}" failonerror="false"/>

    <!-- Build .NET solution in Release mode -->
    <exec program="${DevenvExe}">
      <environment>
        <variable name="COMSUPPORT" value="N"/>
        <variable name="COPYEXECENV" value="N"/>
      </environment>
      <arg value='"${dotnetSlnFile}"'/>
      <arg value='/Rebuild "Release|Any CPU"'/>
      <arg value='/Out "${dotnetOutFile}"'/>
    </exec>
  </target>

</project>
4

1 に答える 1

3

私の提案は、NAnt を完全に置き換え、TFS ビルド ワークフローを使用してビルドをカスタマイズおよび維持することです。とはいえ、NAnt スクリプトがかなり複雑な場合は、時間がかかる可能性があります (特に、TFS ワークフロー ベースのビルドを初めて使用する場合)。まず、ワークフロー ビルドで InvokeProcess アクティビティを使用して、コマンド ライン (nant.exe) 経由で NAnt ビルドを実行することをお勧めします。次に、ビルドの一部を NAnt スクリプトからワークフローに段階的に移動できます。

たとえば、BuildDotNETSolution ターゲット全体は特別なことを何もしていないように見えますが、これらはすべて DefaultTemplate.xaml ビルド ワークフローに既に含まれています。ビルド定義で SolutionsToBuild 引数を指定するだけです。

于 2012-04-18T20:27:33.773 に答える