2014-01-06 55 views
1

我將自定義默認模板以在構建過程中自動更新安裝屏蔽項目的生產版本和產品代碼。哪個在本地機器上正常工作?升級TFS構建模板以自動安裝屏蔽項目

但通過TFS構建它給一個例外,因爲

Exception Message: Retrieving the COM class factory for component with CLSID {52BA76F5-D0A7-4F2E-BD4A-45F8F2CE6A55} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). (type COMException)

我的TFS構建服務器是64位服務器。 及以下自定義活動代碼:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Activities; 
using System.Text.RegularExpressions; 
using Microsoft.TeamFoundation.Build.Client; 
using Microsoft.TeamFoundation.Build.Workflow.Activities; 
using Microsoft.TeamFoundation.VersionControl.Client; 
using ISWiAuto20; 

namespace InstallShieldBuildTask.Activities 
{ 
    [BuildActivity(HostEnvironmentOption.All)] 
    public sealed class IncreaseProductVersion : CodeActivity 
    { 
     // The file mask of all files for which the buildnumber of the 
     // AssemblyVersion must be increased 
     [RequiredArgument] 
     public InArgument<string> InstallShieldFileMask { get; set; } 

     [RequiredArgument] 
     public InArgument<bool> UpdateProductVersion { get; set; } 

     [RequiredArgument] 
     public InArgument<bool> UpdateProductCode { get; set; } 

     // The SourcesDirectory as initialized in the Build Process Template 
     [RequiredArgument] 
     public InArgument<string> SourcesDirectory { get; set; } 
     // If your activity returns a value, derive from CodeActivity<TResult> 
     // and return the value from the Execute method. 
     protected override void Execute(CodeActivityContext context) 
     { 
      // Obtain the runtime value of the input arguments 
      string sourcesDirectory = context.GetValue(this.SourcesDirectory); 
      string installShieldFileMask = context.GetValue(this.InstallShieldFileMask); 
      var updateProductVersion = context.GetValue(this.UpdateProductVersion); 
      var updateProductCode = context.GetValue(this.UpdateProductCode); 

       foreach (string file in Directory.EnumerateFiles(sourcesDirectory, installShieldFileMask, SearchOption.AllDirectories)) 
       { 
        if (updateProductVersion || updateProductCode) 
        { 
        ISWiProject oISWiProj = new ISWiProject(); 
        //Opne the file to read 
        oISWiProj.OpenProject(file, false); 

        if (updateProductVersion) 
        { 
         var currentProductVersion = oISWiProj.ProductVersion; 
         Version version = new Version(currentProductVersion); 
         Version newVersion = new Version(version.Major, version.Minor, version.Build + 1, version.Revision); 
         oISWiProj.ProductVersion = newVersion.ToString(); 
        } 

        if (updateProductCode) 
        { 
         oISWiProj.ProductCode = oISWiProj.GenerateGUID(); 
        } 

        oISWiProj.SaveProject(); 
        oISWiProj.CloseProject(); 

        } 

       } 

     } 
    } 
} 

我看了看下面的鏈接,也不過沒有成功:

http://community.flexerasoftware.com/showthread.php?195743-Integrating-Installshield-2011-with-Team-Foundation-Server-(TFS)-2010&p=464354#post464354

任何關於相同的幫助將是沒什麼太大的幫助我。謝謝!!

@Update 替代解決方案

感謝克里斯!

根據你的指令,我使用MS Build FunctionPropertise來實現這一點。

這是我.ISPORJ文件

<PropertyGroup> 
    <InstallShieldProductVersion>$(ProductVersion)</InstallShieldProductVersion> 
</PropertyGroup> 

<ItemGroup> 
    <InstallShieldPropertyOverrides Include="{$([System.Guid]::NewGuid().ToString().ToUpper())}"> 
     <Property>ProductCode</Property> 
    </InstallShieldPropertyOverrides> 
</ItemGroup> 

我穿過的MSBuild參數從團隊建設的ProductVersion。

回答

1

InstallShield支持MSBuild。 MSBuild現在支持Property Functions(通過調用.NET類上的靜態方法獲得值的屬性)。這意味着現在可以很容易地創建GUID並將其分配給ProductCode。

InstallShield確實需要32位MSBuild平臺,並且可以通過構建定義參數進行配置。

僅使用默認構建過程模板就可以完全自動化InstallShield構建。無需自定義工作流程開發。調用InstallShield自動化接口的自定義MSBuild任務也不是必需的。

如果您希望通過屏幕分享會話來引導您,請隨時給我發電子郵件。

+0

非常感謝Christopher ...我已經用替代解決方案更新了我的問題.. –

0

您是否已經將InstallShield SDK或任何產品的調用安裝在構建服務器上,就像您在開發機器上一樣?

+0

是的,它已經安裝了。 –

0

默認情況下,Team Build將運行64位進程,除非您將其安裝在Windows 8 32位客戶端上。這可能會讓你解決你的問題。您還必須在Build Agent上安裝InstallShield。

或者,創建一個x86命令行可執行文件,其中包含活動中的邏輯。從Custom Activity調用命令行實用程序並使用命令行參數將活動中的參數提供給控制檯應用程序。

+0

已經安裝了Build Agent上的InstallShield。你的第二個選項是有道理的..我試試這個..謝謝! –

相關問題