Windows Installer ability to place short-cut with different URIs - installation

I have a windows form application which is being installed on client pc by using msi file trough active directories, application is a 32bit app which is being deployed to a 32 bit and 64 bit windows systems and as we know application folder names are different between 32 and 64 bit systems, Program Files and Program Files(x86), also during installation application shortcut is placed in startup folder so app will be started when PC us powered up.
Question: Is there a chance to build msi by Windows Installer provided by Visual Studion in such a way that it will check what operating system its being installed at and place the shortcut in to start up folder with correct URI, to Program Files\Applicaiton\ or Program Files(x86)\Applicaiton?
Thank you!

Windows Installer packages are platform aware (x86, x64 ). Windows Installer doesn't support 64bit packages running on 32bit platforms or 32bit packages writing to 64bit ProgramFiles.
You can compile your EXE as AnyCPU and even though it's installed as 32bit it'll execute as 64bit. Although the Visual Studio team has moved away from that and compile as x86 by default in recent versions of Visual Studio.

Upon initialization, the Windows Installer gathers information about the operating system and automatically sets properties that can be used in optional conditional statements used by the setup application, such as VersionNT64 and "System Folder Properties"
In cases where it is necessary for the setup to know this information, it is preferred practice to allow the Windows Installer service to determine folder locations rather than try to hard-code this information into the package.

Related

Detect 32-bit install of program on a 64-bit system

VB.NET Winforms Program, .NET 4.0, compiled with VS2013. 100% managed code; no DLL that depend on a certain processor architecture.
I have two Visual Studio Installer projects, one for x86 and the other for x64.
The program "phones home" to find a new program; right now I detect the processor architecture to determine, if a new program exists, to download the 32-bit or 64 bit installers.
Detection code:
dim sArchitecture as String = ""
If Environment.Is64BitProcess Then
sArchitecture = "x64"
Else
sArchitecture = "x86"
End If
Problem scenario:
Customer has 64 bit machine but downloads 32 bit installer, which of course works properly. In fact, we advise customers who do not know their processor architecture to download the 32 bit installer.
32-bit installer program phones home and sends the x64 processor architecture it detects in the program. Download brings in 64-bit installer, which installs a second copy of the program into the customer's computer and confusion ensues.
What I need to figure out, if I use a Visual Studio installer project, with a TargetPlatform set to x86, is there some reliable way to detect this? Checking the install folder to see if it contains "Program Files (x86)" is insufficient; the customer may have installed the program to another location.
I would truly appreciate the Help!
Thanks
John.
Switch to the Release build and right-click your EXE project > Properties > Build tab. You have the Platform target set to AnyCPU and the Prefer 32-bit checkbox turned off.
Yes, very convenient that .NET program can automatically run in 32-bit and 64-bit mode. You don't need separate builds for the 32-bit and the 64-bit version, nice. Other than that your "detection code" no longer works reliably, the 32-bit installer still deploys a program that runs in 64-bit mode. The only way to discover what installer was used if it does not leave a bread crumb is to reverse-engineer it from the install directory. Yes, not very reliable. Leaving a bread crumb in the registry is otherwise very easy to do, installers are good at writing registry keys.
But just simplify your life, you just don't need a 64-bit specific installer at all. One gets the job done. That it is stored in the "wrong" directory just doesn't matter, you already know it works fine.

Installshield LE won't install a 32-bit executable into Program Files on 64-bit Windows

I'm making installers for plug-ins using the InstallShield LE built in to Visual Studio 2010. The plug-ins run in separate processes, so they are always 32-bit even if the host application is 64-bit. The plugins must be installed to the same directory as the host application. Therefore, the plugins should always install in Program Files even on 64-bit Windows - not Program Files (x86).
InstallShield's [ProgramFilesFolder] predefined folder detects that the project output is 32-bit and evaluates to Program Files (x86) on a 64-bit machine.
I thought I could get around this by using a fixed folder instead of [ProgramFilesFolder]. But Installshield appears to change it to Program Files (x86) anyway! I guess it's trying to be helpful.
Is there any way to get around this?
The redirection is done by the OS, not by InstallShield. The same applies for MSI packages built with other setup authoring tools. I explained this with more details in
How to install VS help using WIX x86 installer on a x64 platform?

Do I have to make allowances for Inno setups on 64-bit Windows?

We've got an ancient of days VB6 app which sometimes needs to be updated and installed on our user's machines. We've begun using Inno, and especially InnoIDE, to make the setup.exe, to get this onto our user's PCs. However, I'm wondering about 64-bit Windows, and Inno setups. We've got a couple of machines in-house, which are 64-bit versions of Windows 7 Professional. I've successfully installed our app, using the setup from Inno, onto a 32-bit Windows XP machine. Can I use the same setup on our 64-bit Windows 7 machines? Will it put the .exe into the C:\Program Files (x86)\ directory structure automatically, or do I have to make allowances for 64-bit versions of Windows?
If your app is only 32-bit, then Inno will automatically take care of doing everything correctly.
Only if your app is mixed or 64-bit do you need to do anything special as rushman says.
There is a very good section in the help file that explains the changes needed.
If you're installing any 64-bit device drivers, the calls to most newdev and setupapi entry points will fail with error code 0xE0000235 (ERROR_IN_WOW64). Those calls only work when invoked from 64-bit code, and Inno doesn't compile 64-bit installers yet. You may work around by using pnputil.exe, by adding a 64-bit stub executable, or by switching to WiX.
For 64-bit INNO intallations you generally only need to add one setup section directive and, obviously, add the 64-bit versions of DLL's and EXE's to the compiled installer.
The setup section directive is:
ArchitecturesInstallIn64BitMode=x64

Incompatibility between x86 and x64 in Installation solution

I have installation solution that have installer project (not web installer but simple installer) that installs NT services, web service and web sites with help of additional two projects of dlls with my own code that performs my installation step. In user actions of installer project I call installer function of one of those projects, and this project calls to installer of second project: installer -> MiddleCaller -> InstallationCore.
All this developing on Windows 7 and work fine when I compile all in 32 bit.
The project must run on Windows 2008. Because of some reasons all must be in x64 bit.
For this purpose, in MiddleCaller and InstallationCore I click right button of mouse on project -> build -> targer x64. For to move installer project to 64 bit in properties of installer (when project is active) I check: Target platform: x64.
When I run installation on x86 I get error:
The installation package is not supported by this processor type"
And this is good, because now I know that my installation compiled in 64 bit, but when I run this on windows 2008 I get:
Error 1001. Exception occured while initializing the instance:
System.BadImageFormatException: could not load file or Assembly
'MiddleCaller, v...' or one of its dependencies. An attempt was
made to load a program with an incorrect format.
Any one has some idea what I need to do for run fine the installation on x64?
May be I still not moved the installer project to x64 bit, if yes, where I do this?
Thank you for ahead.
Found a quick tip on Microsoft's website that could be useful on troubleshooting setup and deployment projects:
64-bit managed custom actions throw a System.BadImageFormatException exception
If you add a 64-bit managed custom action to a Setup project, the Visual Studio build process embeds a 32-bit version of InstallUtilLib.dll into the MSI as InstallUtil. In turn, the 32-bit .NET Framework is loaded to run the 64-bit managed custom action and causes a BadImageFormatException exception.
For the workaround, replace the 32-bit InstallUtilLib.dll with the 64-bit version.
Open the resulting .msi in Orca from the Windows Installer SDK.
Select the Binary table.
Double click the cell [Binary Data] for the record InstallUtil.
Make sure "Read binary from filename" is selected and click the Browse button.
Browse to %WINDIR%\Microsoft.NET\Framework64\v2.0.50727.
Note
The Framework64 directory is only installed on 64-bit platforms and corresponds to the 64-bit processor type.
Select InstallUtilLib.dll.
Click the Open button.
Click the OK button.
There are some unclear things in this scenario. I understand that you are having difficulty running a 32-bit installer that calls on 64-bit assemblies. If this is correct, then what you are doing is not allowed. You cannot have 32-bit and 64-bit assemblies in the same process - that is illegal. If the 64-bit assemblies are being referenced by the installer directly, then the installer must also be 64-bit.
As clarification: I believe a 32-bit installer can install a 64-bit application, but it may only do so by copying the 64-bit files and not by actually making calls into the 64-bit files. The only way this is supported is if the 64-bit files are loaded into a different process and you use IPC to call into them, but even this is likely to be a bad solution.
In your case, I would encourage you to convert your installer into a 64-bit installer.
So, eventually, I compiled MiddleCaller and InstallationCore in AnyCpu mode, when all dll and executables that I need to install were compiled in x64 bit. All this I compiled on Windows 2008 x64 bit with x64 bit outer dependencies (like Oracle client).

Debug XP application on Vista computer

I am building an MFC application for both XP and Vista. I have Visual Studio 2008 installed on the XP machine but I need to debug the application on Vista. How can I do that? Do I really have to install Visual Studio on a Vista machine?
When using remote debugging I assume that all executable and library files must be in my Vista virtual machine. But I can seem to copy the MFC debug DLLs to the Vista VM, and as a result I keep getting side-by-side configuration errors.
I would prefer to remote debug the application without having to copy any files, how can I do that? And if I can't, how can I install the MFC DLLs without having to install Visual Studio on the Vista machine?
Note: I have Vista installed on a virtual machine using Virtual PC. I just don't know how to run the debug version of my application there.
You can install VirtualPC (or other virtualization software) and install Vista as virtual system, so you don't need two computers. For this part of the debugging, it probably better that you explicitly do not install visual studio to make sure there's not some hidden dependency in your program that visual studio provides. At this point you want to be testing the fully-deployed version of the app.
The biggest rule I've found so far for developing for vista is making sure that you never write anything to the same folder where the program is installed. Write to the Application Data folder instead. This was a rule for XP, too, but it's much more strictly enforced in vista.
If you have Visual Studio Pro or Team, you can give remote debugging a shot. There's just a tiny stub that gets installed on the remote computer.
If you want to run a debug build of your application, you will need to install the debug runtime files on the virtual PC as well.

Resources