Installshield:将Installdir设置为环境变量

时间:2022-06-01 18:04:11

EDIT:

编辑:

NO LONGER RELEVANT. Due to difficulties with Installshield including not only this issue but also issues with getting it to build with the project in Visual Studio and its inability to replace one of the old files that needs to be replaced I am now coding an installer in C#. I should have done this earlier because I'd be done by now. Thank you Christopher Painter and Michael Urman for trying to guide me though this issue. Unfortunately I did not get anywhere further with it.

没有更长的相关性。由于Installshield的困难不仅包括这个问题,还包括在Visual Studio中使用该项目进行构建的问题,以及无法替换需要替换的旧文件之一,我现在使用C#编写安装程序。我应该早点这样做,因为我现在已经完成了。感谢Christopher Painter和Michael Urman试图引导我解决这个问题。不幸的是,我没有进一步了解它。

ORIGINAL POST BELOW

以下原始帖子

Honestly, this has been like pulling teeth. I hope that I'm missing something blatantly obvious. I have been trying to get Installshield to let me set the INSTALLDIR to an environmental variable. This is necessary because of the way the company does things. I know I can set it outside of the installer via a batch file which calls the MSI and passes the folder via an argument, but that solution ended up with an unfriendly MSI. If anyone has any internal solutions please let me know.

老实说,这就像拔牙一样。我希望我错过了一些明显的东西。我一直试图让Installshield让我将INSTALLDIR设置为环境变量。这是必要的,因为公司的工作方式。我知道我可以通过调用MSI并通过参数传递文件夹的批处理文件在安装程序之外设置它,但该解决方案最终导致了一个不友好的MSI。如果有人有任何内部解决方案,请告诉我。

2 个解决方案

#1


1  

Windows Installer has the Environment table that is exposed by InstallShield in the environment view and component | advanced settings | environment view.

Windows Installer具有环境视图和组件中由InstallShield公开的Environment表高级设置|环境观。

Setting Environment Variables

设置环境变量

#2


1  

Windows Installer allows you to refer to environment variables using a variant of property notation. I would suggest an approach similar to RobertDickau's, where you use a set-property custom action early to set INSTALLDIR from [%SOMEVAR]. Only run the custom action if INSTALLDIR isn't already defined, so that people can override INSTALLDIR at the command line. Note that this must be run before costing, or you will have to find a different condition and use a set-directory action (like Robert mentions) instead.

Windows Installer允许您使用属性表示法的变体引用环境变量。我建议采用类似于RobertDickau的方法,在这种方法中,您可以尽早使用set-property自定义操作从[%SOMEVAR]设置INSTALLDIR。如果尚未定义INSTALLDIR,则仅运行自定义操作,以便人们可以在命令行覆盖INSTALLDIR。请注意,这必须在成本计算之前运行,或者您必须找到不同的条件并使用set-directory操作(如Robert提及)。

#1


1  

Windows Installer has the Environment table that is exposed by InstallShield in the environment view and component | advanced settings | environment view.

Windows Installer具有环境视图和组件中由InstallShield公开的Environment表高级设置|环境观。

Setting Environment Variables

设置环境变量

#2


1  

Windows Installer allows you to refer to environment variables using a variant of property notation. I would suggest an approach similar to RobertDickau's, where you use a set-property custom action early to set INSTALLDIR from [%SOMEVAR]. Only run the custom action if INSTALLDIR isn't already defined, so that people can override INSTALLDIR at the command line. Note that this must be run before costing, or you will have to find a different condition and use a set-directory action (like Robert mentions) instead.

Windows Installer允许您使用属性表示法的变体引用环境变量。我建议采用类似于RobertDickau的方法,在这种方法中,您可以尽早使用set-property自定义操作从[%SOMEVAR]设置INSTALLDIR。如果尚未定义INSTALLDIR,则仅运行自定义操作,以便人们可以在命令行覆盖INSTALLDIR。请注意,这必须在成本计算之前运行,或者您必须找到不同的条件并使用set-directory操作(如Robert提及)。