2014-01-06 56 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。你的第二个选项是有道理的..我试试这个..谢谢! –

相关问题