Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2012 升级TFS生成模板以自动化已安装的Shield项目_Visual Studio 2012_Build_Installshield - Fatal编程技术网

Visual studio 2012 升级TFS生成模板以自动化已安装的Shield项目

Visual studio 2012 升级TFS生成模板以自动化已安装的Shield项目,visual-studio-2012,build,installshield,Visual Studio 2012,Build,Installshield,我正在自定义默认模板,以便在构建期间自动更新Install Shield项目的生产版本和产品代码。哪个在本地机器上运行良好 但通过TFS构建,它给出了一个异常 异常消息:检索具有的组件的COM类工厂 由于以下原因,CLSID{52BA76F5-D0A7-4F2E-BD4A-45F8F2CE6A55}失败: 以下错误:80040154类未注册(来自 HRESULT:0x80040154(REGDB_E_CLASSNOTREG))。(类型COMException) 我的TFS生成服务器是64位服务器

我正在自定义默认模板,以便在构建期间自动更新Install Shield项目的生产版本和产品代码。哪个在本地机器上运行良好

但通过TFS构建,它给出了一个异常

异常消息:检索具有的组件的COM类工厂 由于以下原因,CLSID{52BA76F5-D0A7-4F2E-BD4A-45F8F2CE6A55}失败: 以下错误:80040154类未注册(来自 HRESULT:0x80040154(REGDB_E_CLASSNOTREG))。(类型COMException)

我的TFS生成服务器是64位服务器。 下面是自定义活动代码:

使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用系统活动;
使用System.Text.RegularExpressions;
使用Microsoft.TeamFoundation.Build.Client;
使用Microsoft.TeamFoundation.Build.Workflow.Activities;
使用Microsoft.TeamFoundation.VersionControl.Client;
使用ISWiAuto20;
命名空间InstallShieldBuildTask.Activities
{
[BuildActivity(HostenEnvironmentOption.All)]
公共密封类IncreaseProductVersion:CodeActivity
{
//所有文件的文件掩码,其中
//AssemblyVersion必须增加
[必需参数]
公共InArgument InstallShieldFileMask{get;set;}
[必需参数]
public InArgument UpdateProductVersion{get;set;}
[必需参数]
public InArgument UpdateProductCode{get;set;}
//在生成过程模板中初始化的SourcesDirectory
[必需参数]
公共InArgument源目录{get;set;}
//如果活动返回值,则从CodeActivity派生
//并从Execute方法返回值。
受保护的覆盖无效执行(CodeActivityContext上下文)
{
//获取输入参数的运行时值
字符串sourcesDirectory=context.GetValue(this.sourcesDirectory);
字符串installShieldFileMask=context.GetValue(this.installShieldFileMask);
var updateProductVersion=context.GetValue(this.updateProductVersion);
var updateProductCode=context.GetValue(this.updateProductCode);
foreach(Directory.EnumerateFiles(sourcesDirectory、installShieldFileMask、SearchOption.AllDirectories)中的字符串文件)
{
if(updateProductVersion | | updateProductCode)
{
ISWiProject oISWiProj=新的ISWiProject();
//选择要读取的文件
OpenProject(文件,false);
if(updateProductVersion)
{
var currentProductVersion=oISWiProj.ProductVersion;
版本=新版本(currentProductVersion);
Version newVersion=新版本(Version.Major、Version.Minor、Version.Build+1、Version.Revision);
oISWiProj.ProductVersion=newVersion.ToString();
}
if(updateProductCode)
{
oISWiProj.ProductCode=oISWiProj.GenerateGUID();
}
oISWiProj.SaveProject();
oISWiProj.CloseProject();
}
}
}
}
}
我也查看了以下链接,但没有成功:

任何关于这方面的帮助都会对我很有帮助。谢谢

@更新 替代解决方案

谢谢你,克里斯

根据您的指示,我使用MS Build FunctionProperties来实现这一点

这是我的.ISPORJ文件

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

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

$(产品版本)
产品代码

我正在通过Team Build的MSbuild参数传递的ProductVersion。

是否在生成服务器上安装了InstallShield SDK或与在开发人员计算机上一样被称为该产品的任何产品?

Team Build默认运行64位进程,除非您在Windows 8 32位客户端上安装它。这可能会让你解决你的问题。您还必须在生成代理上安装InstallShield


或者,创建一个x86命令行可执行文件,其中包含活动中的逻辑。从自定义活动调用命令行实用程序,并使用命令行参数将活动中的参数提供给控制台应用程序。

InstallShield支持MSBuild。MSBuild现在支持(通过调用.NET类上的静态方法获取值的属性)。这意味着现在很容易生成GUID并将其分配给ProductCode

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

仅使用默认的构建过程模板就可以完全自动化InstallShield构建。不需要自定义工作流开发。调用InstallShield自动化接口的自定义MSBuild任务也不是必需的


如果您希望屏幕共享会话指导您完成此过程,请随时发送电子邮件给我。

构建代理上的InstallShield已经安装完毕。你的第二个选择很有意义。让我试试。谢谢!!非常感谢你,克里斯托弗。。。我已用替代解决方案更新了我的问题。。
<PropertyGroup>
   <InstallShieldProductVersion>$(ProductVersion)</InstallShieldProductVersion>
</PropertyGroup>

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