Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup targeting both x86 and x64?

I have a program that requires both x64 and x86 dlls (it figures out which ones it needs at run time), but when trying to create a setup, it complains:

File AlphaVSS.WinXP.x64.dll' targeting 'AMD64' is not compatible with th project's target platform 'x86'
File AlphaVSS.Win2003.x64.dll' targeting 'AMD64' is not compatible with th project's target platform 'x86'
File AlphaVSS.Win2008.x64.dll' targeting 'AMD64' is not compatible with th project's target platform 'x86'

How can I make my setup target both platforms like my program does?

like image 728
Malfist Avatar asked Apr 15 '09 19:04

Malfist


People also ask

Should I target x86 or x64?

So, target x86 or x64. Since x86 apps run on both x64 and x86 systems, the most compatible choice is to build x86. If you MUST build a 64 bit solution, you'll need to target x64 and use our x64 dlls.

How do I change from platform target to x64?

To enable x64 as a CPU platform targetClick Configuration Manager. In the Configuration Manager dialog, open the Active solution platform drop-down list box and click <New> …. In the New Solution Platform dialog, select x64 in the Type or select the new platform drop-down list box.

What is x86 and x64 in Visual Studio?

The Win32 platform name is used for C++ projects, and it means x86. Visual Studio considers both project-level platforms and solution-level platforms, and the project platforms come from the language-specific project systems. C++ projects use Win32 and x64, but the solution platforms use x86 and x64.

How do I change my Visual Studio application from 32-bit to 64 bit?

Open the 32-bit project in Visual Studio 2008. In the file menu, click Build and select Configuration Manager. Pull down the drop-down under “Active solution platform” which currently displays “Win32” and select New. In the drop-down for “Type or select the new platform”, select “x64”.


3 Answers

The MSI created by the setup project (in Visual Studio) can only target one platform at a time. Your option is to either make 2 MSI's, merge them together and make a custom setup boot strapper that choose between the two. There are some 3rd party products,like Advanced Installer for example, that can do this for you.

like image 80
Magnus Johansson Avatar answered Sep 20 '22 12:09

Magnus Johansson


I ran into this too and wrote a blog post about my solution:

  • deflate the file using deflate.exe, naming it with a different extension (e.g. .x64)
  • add it to your main project as a content file
  • add a custom action project to your solution
  • add the custom action to the setup projects "Install" custom actions
  • inflate the file inside the custom actions Install method using
  • System.IO.Compression.DeflateStream (see code above)
  • do a little dance around your desk, down the hall, and past as many coworkers as you care to annoy :)

The deflate.exe file can be downloaded from its repository on google code.

like image 44
Daren Thomas Avatar answered Sep 19 '22 12:09

Daren Thomas


.Net has an "Any CPU" option. It's tempting to think of it as more of a "generic" option that's going to only use the lesser x86 features, but really it lets the JIT compiler on each machine pick the appropriate cpu type for that machine.

The only time you shouldn't use it is if you know you have dependencies or requirements that aren't good for one architecture or the other. For example: you know you need a lot of ram, you have a dependancy on a 32-bit native dll, or you want to pre-compile the app.

There's a danger here because you have a platform-specific dll dependancy. But you have dlls for both types and it sounds like you know how to pick the right one at runtime. So will the 'Any CPU' option work for you?

like image 33
Joel Coehoorn Avatar answered Sep 18 '22 12:09

Joel Coehoorn