views:

1244

answers:

1

I want to build an x86 msi package as well as an x64 package using the same Visual Studio 2008 deployment project.

I see a TargetPlatform in the project properties dialog and I know I can use this to select either x86 or x64 (or Itanium for that matter).

The problem is that I cannot seem to associate this property with a project configuration(?)

Ideally, what I would like to be able to do is to create separate x86 and x64 msi installers by executing devenv.exe twice from a build script (batch file), each call somehow setting the TargetPlatform property by supplying a parameter.

If possible, I would like to avoid having to use WIX or other 3rd-party tools.

Note: I have noticed that the differences between x86 and x64 deployment projects are mainly:

  • Folder\DefaultLocation = ProgramFilesFolder (x86) | ProgramFiles64Folder (x64)
  • Product\TargetPlatform = "3:0" (x86) | "3:1" (x64) | "3:2" (Itanium)

Do I really have to create two separate deployment projects in order to create separate msi packages using devenv.exe just because of those two differences?

I suppose I could use a script to make those changes before each invocation of devenv.exe(?)

+1  A: 

When i had this problem i had to use string replace in the vdproj file before executing the devenv command. For the replace i used the File Replace task of SDCTasks Then my msbuild project looked almost like this:

<Project DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
<PropertyGroup>
<Configuration>Release</Configuration>
<x86>3:0</x86>
<x64>3:1</x64>
<Import Project="$(SDCTasksPath)\Microsoft.Sdc.Common.tasks"/>
<Target Name="Default">
    <File.Replace Path="$(SolutionDirectory)Setup\Setup.vdproj" OldValue="%22TargetPlatform%22 = %22$(x86)%22" NewValue="%22TargetPlatform%22 = %22$(x64)%22" />
<Exec Command="devenv.exe $(SolutionDirectory)Solution.sln /build $(Configuration) /project $(SolutionDirectory)Setup\Setup.vdproj /projectconfig $(Configuration)"></Exec>
ThorHalvor
This solution work for me too. +1
Daok