【发布时间】:2014-12-05 07:01:26
【问题描述】:
我将 InstallShield 2013 用于部署包,我想在单个安装文件中添加两种安装类型(两个应用程序)。我的意思是,在 installShield 运行安装文件时,用户应该能够选择要安装的应用程序。
背景
在我的设置文件中有两个应用程序,即控制台和查看器。用户可以选择他/她想要的应用程序,但所选应用程序的进一步安装不起作用。需要帮助!
这是我的代码。
function OnFirstUIBefore()
NUMBER nResult, nType;
STRING szTitle, szMsg, svResult, szCaption;
NUMBER nSetupType, nvSize, nUser, nReserved;
STRING szQuestion, svName, svCompany, szFile, szLicense;
STRING szLicenseFile,szReserved, svSetupType;
LIST list, listStartCopy;
BOOL bCustom, bCopy, bDontCopy;
begin
MessageBox("OnFirstUIBefore()",0);
SHELL_OBJECT_FOLDER = @PRODUCT_NAME;
nSetupType = CUSTOM;
bCopy = FALSE ;
bDontCopy = TRUE ;
bCustom = TRUE;
szLicense = SUPPORTDIR^ "AbcTerms.rtf";
Dlg_SdWelcome:
szTitle = "";
szMsg = "";
nResult = SdWelcome(szTitle, szMsg);
if (nResult = BACK) goto Dlg_SdWelcome;
szTitle = "";
svName = "";
svCompany = "";
Dlg_SdLicense:
nResult = SdLicense2Rtf ( "","" , "", szLicense , FALSE );
if(nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdCustomerInformation:
nResult = SdCustomerInformation(szTitle, svName, svCompany, nUser);
if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SetupType:
szTitle = "Please select installation type";
szMsg = "";
szReserved = "";
svSetupType = "Viewer";
nReserved = 0;
nResult = SdSetupTypeEx(szTitle, szMsg, szReserved, svSetupType, nReserved);
INSTALLTYPE = svSetupType; //"Console";//
if(svSetupType == "Console") then
MsiSetProperty( ISMSI_HANDLE, "DOCUSTOMEACTION" , 'copy' );
MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" , "ConsoleV3");//"1:3"
else
MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" , "ViewerV3" ); //"1:2"
endif;
MsiSetProperty( ISMSI_HANDLE, "SOURCEPATH" , SourceDir );
if (nResult = BACK) goto Dlg_SdCustomerInformation;
Dlg_SdAskDestPath:
nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
if (nResult = BACK) goto Dlg_SetupType;
Enable(STATUSEX);
return 0; end;
编辑的代码
function OnFirstUIBefore()
NUMBER nResult, nType;
STRING szTitle, szMsg, svResult, szCaption;
NUMBER nSetupType, nvSize, nUser, nReserved;
STRING szQuestion, svName, svCompany, szFile, szLicense;
STRING szLicenseFile,szReserved, svSetupType;
LIST list, listStartCopy;
BOOL bCustom, bCopy, bDontCopy;
begin
MessageBox("OnFirstUIBefore()",0);
SHELL_OBJECT_FOLDER = @PRODUCT_NAME;
nSetupType = CUSTOM;
bCopy = FALSE ;
bDontCopy = TRUE ;
bCustom = TRUE;
szLicense = SUPPORTDIR^ "AbcTerms.rtf";
Dlg_SdWelcome:
szTitle = "";
szMsg = "";
nResult = SdWelcome(szTitle, szMsg);
if (nResult = BACK) goto Dlg_SdWelcome;
szTitle = "";
svName = "";
svCompany = "";
Dlg_SdLicense:
nResult = SdLicense2Rtf ( "","" , "", szLicense , FALSE );
if(nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdCustomerInformation:
nResult = SdCustomerInformation(szTitle, svName, svCompany, nUser);
if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SetupType:
szTitle = "Please select installation type";
szMsg = "";
szReserved = "";
svSetupType = "Viewer";
nReserved = 0;
nResult = SdSetupTypeEx(szTitle, szMsg, szReserved, svSetupType, nReserved);
INSTALLTYPE = svSetupType; //"Console";//
MsiSetProperty( ISMSI_HANDLE, "DOCUSTOMEACTION" , 'copy' );
if(svSetupType == "Console") then
MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" , "ConsoleV3");//"1:3"
else
MsiSetProperty( ISMSI_HANDLE, "INSTALLMODE" , "ViewerV3" ); //"1:2"
endif;
MsiSetProperty( ISMSI_HANDLE, "SOURCEPATH" , SourceDir );
if (nResult = BACK) goto Dlg_SdCustomerInformation;
Dlg_SdAskDestPath:
nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
if (nResult = BACK) goto Dlg_SetupType;
Enable(STATUSEX);
return 0; end;
【问题讨论】:
-
要了解您想要做什么,我有一些问题:您的项目是 InstallScript MSI 类型,对吗?您希望从 InstallShield 项目获得结果吗? msi 包或 InstallShield Setup.exe?你的两个包是什么? msi 文件?
-
这是一个 InstallShield Setup.exe 项目。它甚至包括 InstallScript 部分。有两种设置设计作为查看器和控制台。用户应该能够选择预期的应用程序(设置设计)并且安装过程应该按顺序进行。
-
@LucasF ,编辑后的代码工作正常。
-
对你有好处。控制台模式也适用于旧代码?所以你必须为这两个 INSTALLMODE 做
MsiSetProperty( ISMSI_HANDLE, "DOCUSTOMEACTION" , 'copy' );。 -
是的。如果有多个设置类型,则 MsiSetProperty(ISMSI_HANDLE, "DOCUSTOMEACTION" , 'copy' );应该先运行。然后任何设置类型的进一步安装都运行良好。
标签: c# .net installshield installscript