我將自定義默認模板以在構建過程中自動更新安裝屏蔽項目的生產版本和產品代碼。哪個在本地機器上正常工作?升級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();
}
}
}
}
}
我看了看下面的鏈接,也不過沒有成功:
任何關於相同的幫助將是沒什麼太大的幫助我。謝謝!!
@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。
非常感謝Christopher ...我已經用替代解決方案更新了我的問題.. –