How to target 32bit and 64bit a .NET applications with WiX and separate MSI packages

Target 32bit and 64bit .NET applications

This post will explain how you can build msi packages using WiX for both 32bit and 64bit platforms.  The goal is to create 2 different msi packages. One for 64bit systems, which will install the program in to c:\Program Files on 64bit, and another msi package that will install the program in to c:\Program Files on 32 bit systems. The .NET application itself will be compiled with CPU target Any, which results in that it will run in 64bit mode on 64bit systems and 32bit mode on 32bit systems. Of course, you could also install the 32bit msi package on 64bit systems, which will end up being installed in c:\Program Files (x86).

Pre-requisites:

Microsoft Visual Studio 2008

In my environment, I used 64bit Windows7, so I installed the 64bit version of WiX build 3.0.5419.0-x64-setup

Create a simple .NET application

We will create a simple .NET Winforms application that will show some platform information, like this:

 

image

We will also create a WiX setup project and configure a new platform type in Visual Studio for the 64bit target.

Fire up Visual Studio and create a new Windows Forms project:

image

Add 3 labels to the form:

image

Add code in the Form Load event to fill the labels with info:

 

 

Create a Wix project

Add a new project to the solution, a WiX Setup project:

image

In the Product.wxs file, enter the following code:

 

And add references to WixUIExtension.dll and WixUtilExtension.dll.

What you will notice now is that you have 3 targets in your configuration:

image

The value you choose here will be transferred to the Platform variable in WiX. Unfortunately, the 64bit option is missing, so we must create that one.

Create a x64 configuration entry

Select the Configuration Manager.

image

Select  <New…>

image

image

Select the x64 option and click Ok.

Building

When you now build the Wix project, the output will be created in a new x64 folder. In the Product.wxs code, we also have a title that indicates that is runs in 64bit mode:

image

image

When installed, it will end up in c:\Program Files, just as we wanted.

The 32bit version of the msi is built when you select the x86 platform target

image

image

 

Hope this shed some light on how to deploy .NET applications for multiple targets.

Download the complete solution here.

SharePoint: Solution still deployed after retracting it

Solution still deployed after retracting

You maybe have stumbled upon this scenario: Solution still deployed after retracting it.

After you have retracted your SharePoint solution in Central Administration, the solution flips back to deployed?

The issue seems to be that when you have deployed your solution with –allcontenturls, which means it will be deployed to the Central Administration web application as well, you must specifically retract the solution from the Central Administration web application.

So here are the steps to work around this issue:

  1. Retract the solution from all content URLs
  2. Retract the solution from the Central Administration web application specifically

A problem occurred when Windows tried to activate. Error Code 0x8007232B

You may have encountered an issue when trying to activate your copy of Windows Server 2008 R2.

image

Select Activate now.

image

Select Activate Windows online now.

image

You get this error message, with Error Code 0x8007232B.

To get around this problem, open an elevated command prompt and type the following command:

slmgr -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

 

Where the x’s are your license key.

After you have done that,  you can active successfully.

This information is taken from Microsoft KB929826

Getting Access denied for User Profiles and Properties

If you get access denied when trying to access the User Profiles and Properties page in SharePoint Central Administration,

you need to add the account you are using to the Manage Profiles in Shared Service Rights.

In Central Administration, go to your Shared Services page. Under User Profiles and My Sites, click on Personalization services permissions. Add the account your are using and select  Manage user profiles.