2013-02-08 59 views
2

我在ccnet.config中使用CruiseControl.NET和devenv來自動構建VS 2005 .NET解決方案。該解決方案包含對多個項目的引用,這些項目相互依賴以及包含第三方dll和其他dll的庫文件夾,這些dll是從我創建的項目編譯而來的。CruiseControl.NET,SVN和多個依賴關係

我遇到的問題是試圖設置我的ccnet.config文件,以便在開始devenv任務之前從SVN獲取.NET sln文件和Library文件夾中每個項目的最新更新。

有人可以幫助或指出我在正確的方向,因爲我似乎無法在網上找到任何東西?

下面是我的ccent.config文件,我使用的預處理器的,以避免重複,我會重用這對其他解決方案文件是相似的結構:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder"> 

    <cb:define MainTrunk="svn://mySvnUrl"/> 
    <cb:define WorkingDir="C:\Svn\"/> 
    <cb:define SvnExec="C:\Program Files\CollabNet Subversion Client\svn.exe"/> 
    <cb:define ArtifactsDir="\Artifacts"/> 

    <cb:define name="MyProjectName"> 
     <project name="$(ProjectName)" 
       description="$(ProjectName) build"> 

     <triggers> 
     <!-- check the source control every X time for changes, 
      and run the tasks if changes are found --> 
      <intervalTrigger 
        name="continuous" 
        seconds="500" 
        buildCondition="IfModificationExists" 
        initialSeconds="5"/> 
     </triggers> 

     <sourcecontrol type="svn"> 

      <trunkUrl>$(MainTrunk)/$(ProjectName)/trunk</trunkUrl> 

      <workingDirectory>$(WorkingDir)$(ProjectName)</workingDirectory> 

      <executable>$(SvnExec)</executable> 

     </sourcecontrol> 

     <tasks> 
       <devenv> 
        <solutionfile>$(WorkingDir)$(ProjectName)\$(ProjectName).sln</solutionfile> 
        <configuration>Debug</configuration> 
        <executable>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com</executable> 
        <!--<buildTimeoutSeconds>10</buildTimeoutSeconds>--> 
       </devenv> 

     </tasks> 

     <publishers> 
      <xmllogger /> 
      <artifactcleanup cleanUpMethod="KeepLastXBuilds" 
          cleanUpValue="50" /> 
     </publishers> 

     </project> 
    </cb:define> 

    <cb:scope ProjectName="ProjectA"> 
     <cb:MyProjectName/> 
    </cb:scope> 

</cruisecontrol> 

UPDATE:詢問後問題,我開始考慮解決這個問題的方法是檢查相關項目的修改,如果有變化,然後觸發構建VS解決方案文件ProjectA。所以我已經相應地更新了我的ccnet.config(見下文)。然後,我會將這個應用於我的VS sln中的依賴項目。

如果有人能夠看一看,並且讓我知道我是否朝着正確的方向前進,

<cruisecontrol xmlns:cb="urn:ccnet.config.builder"> 
    <!-- This is your CruiseControl.NET Server Configuration file. Add your projects below! --> 
    <cb:define MainTrunk="svn://SvnUrl"/> 
    <cb:define WorkingDir="C:\Svn\"/> 
    <cb:define SvnExec="C:\Program Files\CollabNet Subversion Client\svn.exe"/> 
    <cb:define ArtifactsDir="\Artifacts"/> 

    <cb:define name="MyProjectName"> 
     <project name="$(ProjectName)" 
       description="$(ProjectName) build"> 

     <triggers> 


      <projectTrigger project="Libraries"> 
      <triggerStatus>Success</triggerStatus> 
      <innerTrigger type="intervalTrigger" 
          seconds="120" 
          buildCondition="ForceBuild" /> 
      </projectTrigger> 

     </triggers> 

     <sourcecontrol type="svn"> 

      <trunkUrl>$(MainTrunk)/$(ProjectName)/trunk</trunkUrl> 

      <workingDirectory>$(WorkingDir)$(ProjectName)</workingDirectory> 

      <executable>$(SvnExec)</executable> 

     </sourcecontrol> 

     <tasks> 
       <devenv> 
        <solutionfile>$(WorkingDir)$(ProjectName)\$(ProjectName).sln</solutionfile> 
        <configuration>Debug</configuration> 
        <executable>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com</executable> 
        <!--<buildTimeoutSeconds>10</buildTimeoutSeconds>--> 
       </devenv> 

     </tasks> 

     <publishers> 
      <xmllogger /> 
      <artifactcleanup cleanUpMethod="KeepLastXBuilds" 
          cleanUpValue="50" /> 
     </publishers> 

     </project> 
    </cb:define> 

    <cb:scope ProjectName="ProjectA"> 
     <cb:MyProjectName/> 
    </cb:scope> 

    <project name="Libraries"> 
     <triggers> 
      <intervalTrigger name="continuous" seconds="60" buildCondition="IfModificationExists" initialSeconds="5"/> 
     </triggers> 
     <sourcecontrol type="svn">      
      <trunkUrl>svn://SvnUrl/Libraries</trunkUrl> 
      <workingDirectory>C:\Svn\Libraries</workingDirectory> 
      <executable>C:\Program Files\CollabNet Subversion Client\svn.exe</executable>   
     </sourcecontrol> 
    </project> 

</cruisecontrol> 
+0

你遇到什麼問題,當您使用提到的配置? – metalheart

+0

@metalheart - 配置沒有問題,因爲在構建工作中,但如果我更改我的Libraries文件夾並檢入SVN,構建服務器將無法從SVN獲取最新版本的Libraries文件夾,因爲它沒有定義在配置中。我如何告訴它獲取最新的Libraries文件夾,然後觸發ProjectA的構建?謝謝。 – creativeincode

+0

是項目幹線內部還是外部的庫文件夾? – metalheart

回答

1

只要你包括在每個項目的根的第三方庫通過對項目軀幹指向庫文件夾的svn:externals屬性,使用下面的開關sourcecontrol配置塊中:

<checkExternals>True</checkExternals> 

這樣CC.NET也會在庫文件夾中修改時觸發編譯。

您可能還需要:

<checkExternalsRecursive>True</checkExternalsRecursive> 
+0

感謝金屬之心。不幸的是,我沒有配置我的項目根目錄通過svn:externals包含第三方庫。我已經修改了配置並在上面發佈。你認爲我提出的是可行的嗎?謝謝。 – creativeincode

+1

@creativeincode:似乎對我來說(但你必須自己檢查),你可能也有興趣閱讀[this](http://stackoverflow.com/questions/1273619/how-do-i-setup-multiple -triggers-for-cruisecontrol-net/1276263#1276263)作爲替代品(可能不那麼複雜) – metalheart

+0

這似乎是我所追求的,謝謝你的幫助! – creativeincode