Using WiX to install VB6 Binaries - vb6

I am converting an InstallShield project to a WiX based Installer. I have a number of VB6 projects whose binaries need to be registered.
The InstallShield project actually marks these as self-registering files. From what I have read this seems to be a "Bad Thing" in the Windows Installer world.
My question is, what should I be doing then? A VB6 project could have its internal GUIDs change after each recompile - and yes I'm already using Binary Compatibility.
I've used Heat to generate all the Registry and Class entries, but some of these entries change from build to build. I've read that Heat wasn't designed to be used every build, but instead to be used as a starting point.
What are others doing to deal with VB6 and WiX registration?

We have two types of components we develop in VB6. Latent common components that we reference across projects and volatile application components that we build daily. The common components are packed as merge modules (using WiX) while the application components map to components of the application setup. This is a snippet of our main .wxs file
<Component Id="MyFile15.ocx" Guid="YOURGUID-BCB7-451C-B07D-D205AEAE1EB9" >
<File Id="MyFile15.ocx" Name="MyFile15.ocx" LongName="MyFile15.ocx" KeyPath="yes" src="$(var.SrcAppBinnPath)\MyFile15.ocx" DiskId="1" />
<?include Registry_MyFile15.wxi ?>
</Component>
We are still using WiX 2.0 so we are using a tweaked version of tallow to produce the registry .wxi files for all the ActiveX DLLs/OCXs/EXEs we are building daily. Instead of com/typelib entries we are shipping all of the COM registration as direct registry table entries. We are targeting legacy Windows Installer 2.0 because we dont need any of the newer features.
We are using custom actions (VC6 DLLs) for some special cases -- MSDE setup, database patching, DCOM download/setup. We are using a Platform SDK bootstrapper that downloads instmsiX.exe and prepares Windows Installer on virgin systems (mostly 9x and NTs). We are using 7-zip self-extractor to unpack bootstrapper and msi on client machine. In some cases we are using UPX --lzma on executables but these do not scale very well on Terminal Servers where the non-packed versions are reused across sessions.
Lately we've been migrating our clients to portable builds using reg-free COM. We are using our in-house UMMM tool to produce registration-free COM manifests. SxS COM has limitations (no DCOM, no ActiveX EXEs) but allows us to change builds while the application is live -- no reinstall downtime.

One thing we've been toying with is eliminating global COM registration altogether by using registration-free COM. (The main advantage we are after is the ability to deploy different versions of the same application side by side in complete isolation.)
However, with registration-free COM you still have to write or generate the manifest files that need to be deployed by the setup. The answers to the linked question show that there are some tools to help with that.
In the mean time, we also still use a mix of self-registration and automatic wxs generation with heat.exe for our old VB6 and Delphi libraries. While you are right that heat was not initially designed to be used like that, it has been moving in that direction for a while now.
In any case, stable regeneration of identifiers (which is what was missing in the initial design of heat.exe) is only important if you want to support minor upgrades or share components between applications. We just completely uninstall the previous version of the product during an upgrade (aka a major upgrade), so we don't need to worry about such things.
edit: Since writing this answer in 2010, I've learned a thing or two about windows installer. I no longer believe that a major upgrade frees you from the need for stable GUIDs. Component GUIDs should stay stable as much as possible between in-place upgrades. Major upgrades don't always have the same end result as uninstalling+reinstalling.

I went a different route and defined all my objects using interfaces I created in IDL and compiled to type libraries(.tlb). A slightly long winded approach but it means all the GUIDs remain fixed regardless.
I am able to impliment versions of the interfaces and handle multiple versions of the dll in the same file.
Drawbacks are, this doesn't help with OCX controls and you can't use events accros the tlb boundary. This is not an issue for me as I generally use callbacks from DLL's to their callers as they can be more efficient.
This product is deployed on DVD to clients around the world, currently using an InstallShield installer but I am investigating moving to WiX as well.

Related

What are the differences between Microsoft.Office.Core.CustomTaskPane and Microsoft.Office.Tools.CustomTaskPane..?

I'm creating my first VSTO add-in for Microsoft Office, and just I realized there are two types for CustomTaskPane, and I got them crossed:
Imports Core = Microsoft.Office.Core 'Version 12
Imports Tools = Microsoft.Office.Tools 'Version 9
What are the differences..?
I understand they're in different libraries, but I was wondering what else might be different. If I look in Object Browser, the Tools version has some additional methods and functions, but otherwise seems the same. I cannot remove the Office reference, since I'm using members from it which do not exists in Tools.
They seem to be the same type, but looking at the Base Types, the Tools version makes no references to the Core version. I inadvertently crossed the two versions in my code, and it still worked. But since this is a VSTO add-in, it seems prudent to clean up the code and stick with the Tools version.
Can someone with more experience shed some light on this..?
As you noticed, the Tools version provides expanded functionality. There are a large number of Tools objects of this type, not all provide expanded functionality, however.
VSTO "wraps" objects provided by Office COM libraries so that they can be used more "natively" by the .NET Framework and, in special instances, provide additional, useful functionality not provided by the COM libraries.
As long as you don't want to use any of the expanded functionality, in theory it doesn't matter whether you use the Tools or COM Interop namespace. In practise, using the original COM version can be faster in execution.
Personally, my preference is to consistently work with the COM Interop objects unless I specifically want to work with functionality provided by the Tools.
In the case of Custom Task Panes, however, you should use the Tools namespace. This has been optimized to work with Windows Forms and WPF controls and generally integrate with .NET Framework code.

How to distribute a windows application?

What's the best way to distribute a windows application:
Which format should i use to distribute the application, an exe-file
or a zip-file?
Should i sign the application?
Are there any other points i should take into account?
I'm going to create an installer for the application using innosetup. The application is made using node-webkit.
(I'm not a Windows user, but) MSI package is better than both an exe-file and a zip-file. The freedom to choose interactive or unattended [un]installation, and the ability to handle dependencies and upgrades are enough to make it the best option. WiX makes MSI creation easier -- give it a try.
So long as the application deploys - it makes no functional difference the data format you choose to distribute in.
I will speak from a user perspective as opposed to a technical one here; please include a CLEARLY LABELED installer (MSI is the best for this; but if it is .exe, or .bat or whatever, label it as "Installer" or "Click to install" or something similar) and a useful readme, if you do choose to distribute in a .zip.
It all depends on what the exe entails. If it's just a simple .NET executable and it's self contained, all you need is the exe in a zip (pending it's < .NET 2.0 which is included). Each newer succeeding version of Windows has .NET runtimes built into the OS incrementing all the way up to 4.5 or 5.0?
So if you have the latest Windows, and it has the .NET 4.5 libraries on it, all you need is essentially the executable. However if it is an older OS, you may need to bundle or link the runtimes needed. Some apps need third party components installed and other DLL's. In which case your best bet would be to use a third party tool like Install Shield or Wise, or Orca, where you can customize the install and install third party components like SQL Server Personal, Oracle Personal or mySQL Database or Crystal report components.
Also if NTFS permissions and network permissions are required or registry values are required you'll need to script it with Wise, InstallShield, etc, and require elevated permissions. Microsoft also has some built in Deploy Once(?) tools that allows this to be done via the web, or network path or executable.
It all depends on the complexity of your exe, how much it effects your system etc. I've seen apps that require even firewall exceptions, etc. If you are in a corporate environment and have a domain you can deploy using SCCM/SMS or UniCenter. Like I said it all depends on complexity, and scope.
If it's a simple .NET 2.0 app, then all you need is the exe in a zip. The best way would be to copy the exe to a few different systems and test it.
MSI's are inherently able to execute from shell or run/explorer. Also you are allowed to compile your install into a self contained executable.
Bottom line, it all depends on your app :)

A WIX Interpreter?

I have a need to describe deployments/installs, and possibly uninstalls as well - but I don't want to use Windows Installer. At the same time, I don't want to completely re-invent the wheel.
It occurred to me that I could perhaps use the WIX declarative schema, but create my own "WIX interpreter" that will perform the install / uninstall steps (as described by a target WIX xml document) without using the windows installer.
It would be nice to go a step further, so that I achieve a cross-platform (Linux, MAC) installer-interpreter. Of course WIX did not have Linux and MAC in mind. In which case I either add xml namespaces to extend WIX, or use some other industry format (that I am yet unaware of).
But perhaps I'm stretching too far. At the very least it would be nice to have a WIX interpreter or a WIX install executable that does not create any records in the windows installer. It need not fulfill every capability of the windows installer. I'd just like to see some basic capabilities fulfilled.
Does anyone know of such a thing, so I can save myself the effort of making it myself?
Each operating system has their own means of managing installed packages.
That means that if you implement your own package management scheme, it will not integrate well with the current operating system standard. This has a number of very bad side effects, mainly the people maintaining the operating system through standard tools run a high risk of not knowing your software was installed because the standard tool didn't report it was installed.
Microsoft's installer is quite different than many other installers, and it supports extension via programming, which is typically done in the VB C++ language. Also, Microsoft supports the mixing of configuration and installation, while many other package managers see these as different functions to be performed at different times. Finally, Microsoft attempts to ask for the configuration information PRIOR to installation, while installers that separate out the role of configuration and installation typically request that the configuration be done AFTER the program is installed.
In truth, there are way too many different "assumptions" about what constitutes installation, and when / how to do said items, and what tools can be expected on particular platforms to easily merge "all items" into a single multiple-system installation tool without the vendors coordinating a little bit to allow for some compatibility.

Regular DLL using: MFC Shared vs MFC statically linked

When we create a DLL using Visual studio (VC8 or 9), we get an option as
create Regular DLL
using MFC as shared DLL
or
using MFC as static library
How are they different? Which one is advisable to use?
A static library means the code you use from the library is included in your executable. Because of this, you don't need to ship the library or require the end user to have it on their machine. However this bloats the size of your executable and ties you to that library version, so if you need to update just the library, you have to ship a new executable.
A shared library calls the library at the time it needs it (runtime) to execute the code, but it requires the user to have it (usually a specific or minimum version) installed on their machine. You can also distribute the required version of the library with your application if you need to.
As for which is better, I don't know. I'm not a Windows C++ or MFC programmer so I couldn't say. On my Linux servers, the applications I write are generally server-side and thus use shared libraries.
It depends on how your application is to be used, distributed, updated, how often the MFC library changes, if it's generally available on user's PCs etc.
[I think I got my answer now]
If you use MFC DLL as dynamic linking, your code will need the Microsoft Foundation Library DLL's (specifically the version your code requires) installed along with your application or dll in the user end. So this means your installation package would contain
Your application/DLL and supporting files
All MFC Dlls
This makes the installation package size go bigger and also make take time for user to download your installation setup.
If you link to MFC as static library, you code will work even without MFC DLLs present at the user end . The reason being pretty simple that all the MFC libraries you refererred in your code, will be linked into your application or dll. This means those MFC libraries used in your app/dll becomes the part of the your binary; however, your app/dll will be little bigger.
Another consideration is servicing your application.
If you ship the MSFT redis, dynamically linking against its libraries, and then MSFT later "fixes" some vital flaw in a DLL, they patch the DLL on your customer's machines through Window's Update. If you statically link, you will need to update all your customers directly.
Of course, if you are concerned that a patched DLL might break your application (because you rely on unspecified behavior), you may want to handle the servicing (and testing) directly with your customer.

Creating a windows installer for a Visual Studio project

I want to create an installer for my project, primarily to handle the external dependencies which are starting to grow in number.
The problem is most of these components seem to be distributed in different manners, so I need an installer that can cope with all the following. Ive looked at various things around, however many dont seem to cover all the things I need (like how to install directX using a Visual Studio setup project...), or dont even create a proper windows installer (eg .msi).
Copy all my apps files to the target directory
Create start menu and desktop shortcuts
Install direct x (ie call dxsetup.exe /silent)
Install the VC9 CRT redist (seems to be a "merge module" looking at msdn whatever that is...)
Only requires administrative rights if one of the following is true
DirectX and/or the VC9 CRT is not already present, or needs updating
Installing for all users
Installing to a directory the user doesnt have write permission for
Can roll back everything if installation is aborted before completion
Generates an uninstaller as well as an installer
Ensures the user accepts all required EULA's (my one, VC9 Redist, DirectX, etc)
For example I got the VS2008 Setp Project working for my app files and the VC9 CRT, however I dont see anyway to tell it to just run dxsetup.exe with the /silent argument and NOT extract it and all the other dx installer to the app directory or something...
EDIT:
Also it would be really nice if I could have a unified installer for x86 and x86-64, which installers the correct components (eg myapp_x86.exe or myapp_x64.exe) depending on if the OS is 64bit or not.
EDIT2:
Forgot to mention but either a free or low cost solution would be welcome as well, since I need a solution for some of my smaller personal stuff as well.
WiX is what you want. You'll want to read through the v3 documentation and examples, as it is not a simple thing to use. Once you get going, you'll have follow-up questions which you should post as new questions.
See also the WiX tutorial, but keep in mind it refers to v2, and a lot of it is out-of-date or obsolete in v3.
If you can afford it, Installshield does all this very well and professionally. It will include the merge file and seamlessly install as well. Installshield has its quirks, but it is incredibly easy to use and robust. Once you write your app, you don't want to think a lot about the installer.
Some nice features I liked
Creates patch installs by diff'ing the source so you can distribute patches with a small size.
Create upgrades that update the registry and version number of your app. Prevents older versions from being installed.
Creates an nice uninstaller.
It's Easy to add merge modules.
Scriptible if you need it to be, GUI if not (most of the time you don't need to script a thing).
If you can't afford that, go with NSIS. It is very powerful and well used, but prepared to write code in a text editor.
Follow these STeps

Resources