2016-08-04 50 views
0

我最近刚刚得知,通过产生的InstallShield新的产品代码,安装程序将升级软件以前的版本,而不需要用户先卸载以前版本的。这是一个伟大的第一步,但它似乎仍然喜欢我应该能够自动生成一个新的产品代码,每次我建造时间的过程。目前我必须手动记住在构建新安装程序之前执行此操作。如何使用InstallShield自动创建新的产品代码?

我使用InstallShield 2015年LE,所以我不知道这可能是的LE版本,或者不是限制。有人对InstallShield有更多的经验吗?请解释一下如果可能的话以及我如何设置这个请求?

回答

1

ProductCode存储为一个属性,因此您可以编辑.islproj文件(或者其使用的任何名称为msbuild-syntax项目文件)来为该属性指定新的guid值。通过添加类似如下的的ItemGroup按照Customizing the .isproj File概述的方法。请注意,此示例假定您在某种程度上在$(MyNewProductCode)中提供了有效的GUID。

<ItemGroup> 
    <InstallShieldPropertyOverrides Include="$(MyNewProductCode)"> 
     <Property>ProductCode</Property> 
    </InstallShieldPropertyOverrides> 
</ItemGroup> 
1

您是通过命令行还是通过msbuild或某种自动方法构建?如果你是,你可以用下面的方法:

:: Change Product Code for Build 
FOR /f "delims=" %%i IN ('"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\x64\uuidgen.exe"') DO SET productcodeguidcl=%%i 
"C:\PATHTOFNR\fnr.exe" --cl --dir "C:\PATHTOYOURISM" --fileMask "YOUR.ism" --useRegEx --alwaysUseEncoding "utf-8" --find "ProductCode.*{.*}" --replace "ProductCode</td><td>{%productcodeguidcl%}" 

注意下面的示例假定您有uuidgen.exe(免费),构建服务器上,还需要免费工具fnr.exe(https://findandreplace.codeplex.com/

我们用它进行基本的微星,微星INSTALLSCRIPT的一段时间和项目INSTALLSCRIPT没有任何问题,直到我们终于接通我们的项目到Installshield的API的。

0

为了扩展迈克尔Urman的回答以上,我能够从.isproj文件中使用property function直接生成新的GUID。当我的CI机建立我的安装盾构工程,产品代码使用这个自动更新:

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

万岁自动化。