TFS,升级模板生成自动运行安装金盾工程 [英] Upgrading TFS Build Template to Automate Installed Shield Project

查看:441
本文介绍了TFS,升级模板生成自动运行安装金盾工程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自定义默认模板自动更新生成过程中安装盾构工程的生产版本和产品code。这是在本地机器工作正常?

I am customizing Default Template to Auto update the Production version and Product code of Install Shield project during the build. Which is working fine in local machine?

但通过TFS构建它给一个例外,

But through TFS Build it’s giving an exception as

异常消息:检索COM类工厂组件与
  CLSID {52BA76F5-D0A7-4F2E-BD4A-45F8F2​​CE6A55}失败,由于
  以下错误:80040154没有注册类(从异常
  HRESULT:0x80040154的(REGDB_E_CLASSNOTREG))。 (类型收到COMException)

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位服务器。
及以下自定义活动code:

My TFS Build server is 64 Bit server. And below is Custom Activity code:

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();

                    }

                }

        }
    }
}

我看了看下面的链接,但也没有成功:

I looked at below links also but no success:

<一个href=\"http://community.flexerasoftware.com/showthread.php?195743-Integrating-Installshield-2011-with-Team-Foundation-Server-%28TFS%29-2010&p=464354#post464354\" rel=\"nofollow\">http://community.flexerasoftware.com/showthread.php?195743-Integrating-Installshield-2011-with-Team-Foundation-Server-(TFS)-2010&p=464354#post464354

任何有关相同的帮助将是对我来说很有帮助。谢谢!

Any help regarding the same would be much helpful for me. Thanks!!

@Update
另一种解决方案

@Update Alternative Solution

由于克里斯!

按照您的指示,我用MS建立FunctionPropertise实现这一目标。

As per your instruction i used MS Build FunctionPropertise to achieve this.

这是我的 .ISPORJ文件

Here is my .ISPORJ file

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

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

我通过参数的MSBuild从团队的建设的ProductVersion

推荐答案

的InstallShield支持的MSBuild。的MSBuild现在支持属性函数(属性那里的价值在.NET类)。这意味着它现在很容易创了一个GUID,并将其分配到产品code。

InstallShield supports MSBuild. MSBuild now supports Property Functions (properties that get there value by calling static methods on .NET classes ). This means it's now easy to gen up a GUID and assign it to ProductCode.

的InstallShield确实需要32位的MSBuild平台,这可以通过构建定义参数进行配置。

InstallShield does require the 32-bit MSBuild platform and this can be configured via the build definition parameters.

有可能完全自动化只使用默认的构建过程模板一个InstallShield版本。没有自定义工作流开发是必需的。自定义的MSBuild任务调用的InstallShield自动化接口不需要任何

It is possible to fully automate an InstallShield build using just the default build process template. No custom workflow development is required. Custom MSBuild tasks calling the InstallShield Automation Interface isn't required either.

请随时给我发电子邮件,如果你想在屏幕共享会话引导您完成它。

Please feel free to email me if you'd like a screen sharing session to walk you through it.

这篇关于TFS,升级模板生成自动运行安装金盾工程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆