windows 如何在 XP/Vista 及更新版本上为 VB6 创建一个简单的安装系统?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create a simple install system for VB6 on XP/Vista and newer?
提问by BCS
Heavy emphasis on simple. I've never made an installer and I'd rather not have to learn much. A system that I could hand a pile of files to and it would make some smart guesses about where to put them would be ideal.
重在简单。我从来没有做过安装程序,我宁愿不必学习太多。一个我可以将一堆文件交给它并且可以对将它们放在哪里做出一些聪明的猜测的系统将是理想的。
Go ahead and answer the general question.
继续回答一般问题。
However In my cases I'm stuck with some extra constraints. The program to be installed is written in VB6 (or is it 5?) and a few previous versions of VB, so it's notgoing to be updated any time soon. I have a running install and will have a Clean VM to play with So I'll be doing a loop of: run the install, find where it's broken, fix it, add that to the installer, revert the VM, try again. If anyone has a better approach I'm open to suggestions.
但是,在我的情况下,我遇到了一些额外的限制。要安装的程序是用 VB6(还是 5?)和几个以前版本的 VB 编写的,所以它不会很快更新。我有一个正在运行的安装并且将有一个干净的 VM 可以玩所以我将执行以下循环:运行安装,查找损坏的位置,修复它,将其添加到安装程序,恢复 VM,再试一次。如果有人有更好的方法,我愿意接受建议。
I MUSTget it working on XP and I'd really like to also have something that will work on newer versions of Windows as well.
我必须让它在 XP 上运行,而且我真的很想也有一些可以在较新版本的 Windows 上运行的东西。
回答by Imran
回答by Brian Ensink
I've used InnoSetup several years ago, before Vista, and was very happy with it then. I only had a few files to install and a Start menu icon. It worked great, and was easy to learn.
几年前,在 Vista 之前,我使用过 InnoSetup,当时对它非常满意。我只需要安装几个文件和一个开始菜单图标。它工作得很好,而且很容易学习。
回答by Nick
Dependency Walkeris super useful for finding out which dll is missing from the installer. Once you know the dll, you can find what merge module it is in using the Merge Module Finder.
Dependency Walker对于找出安装程序中缺少哪个 dll 非常有用。知道 dll 后,您可以使用Merge Module Finder找到它所在的合并模块。
回答by Tanerax
I have worked with NSIS and getting past some of its minor complexities its a fantastic system. its free, offers tons of plugin ability and managed to do everything I needed to do.
我曾与 NSIS 合作,克服了它的一些小复杂性,这是一个很棒的系统。它是免费的,提供了大量的插件功能,并设法完成我需要做的一切。
回答by Bob77
Creating a full setup package for a program is almost a subject area in itself. There are many factors to consider and most of us aren't running Windows 95 anymore. The world is not as simple as it once was.
为程序创建完整的安装包本身几乎就是一个主题领域。有许多因素需要考虑,我们中的大多数人不再运行 Windows 95。世界不再像从前那么简单。
There are a lot of things that need to be addressed, and some of these "setup" issues mean changing the program too. For example the "protected folders" concept that seemed to be new to people when Vista UAC came on the scene. I guess they were all running as admin or something? In its simplest form it means you don't put writeable files next to the EXE in Programs (aka "Program Files") anymore.
有很多事情需要解决,其中一些“设置”问题也意味着更改程序。例如,当 Vista UAC 出现时,“受保护的文件夹”概念对人们来说似乎是新的。我猜他们都以管理员身份运行还是什么?在最简单的形式中,这意味着您不再将可写文件放在程序中的 EXE 旁边(又名“程序文件”)。
Another factor is that the way the registry is used has changed. I'm not talking about registry virtualization, though that's part of it as well. But COM registration can be done both per-machine and per-user and even turning UAC off can muck this up. See Per-User COM Registrations and Elevated Processes with UAC on Windows Vista SP1. The result is that a setup package shouldn't be running regsvr32 (or otherwise calling the self-reg entrypoint of a COM library). See "Remarks" at SelfReg Table.
另一个因素是注册表的使用方式发生了变化。我不是在谈论注册表虚拟化,尽管这也是其中的一部分。但是 COM 注册可以在每台机器和每用户上完成,甚至关闭 UAC 也可以解决这个问题。请参阅Windows Vista SP1 上使用 UAC 的每用户 COM 注册和提升进程。结果是安装包不应运行 regsvr32(或以其他方式调用 COM 库的 self-reg 入口点)。请参阅SelfReg 表中的“备注” 。
Windows Installer is theway to go forward in most cases. VB6 programmers have Visual Studio Installer 6.0 version 1.1 available as a free download for creating MSI packages. See "COM Servers" at the VFP article Using Microsoft Visual Studio Installer for Distributing Visual FoxPro 6.0 Applicationsfor some valuable information.
在大多数情况下,Windows Installer 是前进的方式。VB6 程序员可以免费下载 Visual Studio Installer 6.0 版本 1.1 来创建 MSI 包。有关一些有价值的信息,请参阅 VFP 文章使用 Microsoft Visual Studio 安装程序来分发 Visual FoxPro 6.0 应用程序中的“COM 服务器” 。
This isn't the easiest option but there is a VB Setup Wizard in VSI 1.1 to help get the basics right. Doing advanced things like creating a [CommonAppData] subfolder and setting Everyone rights on it has to be done in a post-build step outside the IDE. That's where 3rd party tools can be useful to give you more control without resorting to Orca or post-build Installer scripts.
这不是最简单的选项,但 VSI 1.1 中有一个 VB 安装向导,可帮助您正确掌握基础知识。必须在 IDE 之外的构建后步骤中完成诸如创建 [CommonAppData] 子文件夹并为其设置“所有人”权限等高级操作。这就是 3rd 方工具可用于为您提供更多控制而无需求助于 Orca 或构建后安装程序脚本的地方。
Those guys making scripted "legacy" installers try to keep up, but the scripting gets more and more complicated. The results are sometimes iffy. Windows 7 introduces a few new wrinkles of its own.
那些制作脚本“遗留”安装程序的人试图跟上,但脚本变得越来越复杂。结果有时是不确定的。Windows 7 引入了一些自己的新问题。
While ClickOnce isn't really the best option for VB6, nothing says you can't use reg-free COM for XCopy installs of many programs. Reg-free COM can even be a good option for use in an Installer package for that matter.
虽然 ClickOnce 并不是 VB6 的最佳选择,但没有什么说你不能使用 reg-free COM 来安装许多程序的 XCopy。就此而言,免注册 COM 甚至可以成为在安装程序包中使用的不错选择。
So in the end the "simplest" way to deploy VB6 programs is probably going to be reg-free COM XCopy packages wrapped in a self-extracting EXE that will fire off a script to create a Start Menu shortcut. If you can live without the shortcut this is even easier: just unzip the package where it needs to go!
因此,最终部署 VB6 程序的“最简单”方法可能是将无 reg 的 COM XCopy 包封装在自解压 EXE 中,该 EXE 将触发脚本以创建开始菜单快捷方式。如果您可以不使用快捷方式,那就更容易了:只需将包解压缩到需要去的地方即可!
See Make My Manifestor alternative tools for reg-free COM packaging.
请参阅Make My Manifest或用于免注册 COM 打包的替代工具。
This requires that the target systems be running XP (preferably SP2) or later. The only possible glitch here is that XP did not include the VB6 SP6 runtimes until XP SP3, so you'll want to test your program against the VB6 SP5 runtimes first. Well one more glitch: you can't use ActiveX EXEs this way, they still require registration.
这要求目标系统运行 XP(最好是 SP2)或更高版本。这里唯一可能的故障是 XP 直到 XP SP3 才包含 VB6 SP6 运行时,因此您需要首先针对 VB6 SP5 运行时测试您的程序。还有一个小故障:您不能以这种方式使用 ActiveX EXE,它们仍然需要注册。
回答by jmatthias
My advice is this. Try to keep the installer as simple as possible. Windows Installer is a very complicated piece of software and when things don't work right it can be hard to figure out what's going on. I'm sure we have all experienced the endless loop of Windows Installer trying to repair a file that you no longer have the source .msi file for.
我的建议是这样的。尽量使安装程序尽可能简单。Windows Installer 是一个非常复杂的软件,当事情不正常时,很难弄清楚发生了什么。我相信我们都经历过 Windows Installer 尝试修复您不再拥有其源 .msi 文件的无限循环。
Most of the time using Windows Installer is like using a sledge hammer to crack a nut.
大多数情况下,使用 Windows Installer 就像使用大锤敲碎螺母一样。
I use InnoSetup for my own stuff and InstallShield at work (against my will). Start with a simple script based installer and only use Windows Installer if you have a good reason to.
我将 InnoSetup 用于我自己的东西并在工作中使用 InstallShield(违背我的意愿)。从一个简单的基于脚本的安装程序开始,只有在有充分理由的情况下才使用 Windows Installer。
Note that support for installing assemblies to the GAC may be missing for some non Windows Installer setup tools (such as InnoSetup).
请注意,某些非 Windows Installer 安装工具(例如 InnoSetup)可能缺少对将程序集安装到 GAC 的支持。
回答by Brad Bruce
I usedto LOVE Inno Setup. Emphasis on "used to".
我曾经喜欢 Inno Setup。强调“习惯”。
When you run the single file installer (what you'd typically do), it unpacks the real setup program into a folder under the temp folder and then tries to execute it. The problem is... some anti-virus programs don't allow this.
当您运行单个文件安装程序时(您通常会这样做),它会将真正的安装程序解压到临时文件夹下的一个文件夹中,然后尝试执行它。问题是...一些防病毒程序不允许这样做。
The author is aware of this and refuses to do anything about it. The folder name is random, so cannot be added to any exemption list your anti-virus program may use.
作者知道这一点,并拒绝采取任何行动。文件夹名称是随机的,因此不能添加到您的防病毒程序可能使用的任何豁免列表中。
Again. The author is aware of this and suggests that I tell my users to turn off their anti-virus programs during installation. (Like that's going to happen)
再次。作者知道这一点,并建议我告诉我的用户在安装过程中关闭他们的防病毒程序。(就像那会发生一样)