views:

1994

answers:

2

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?

+1  A: 

.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?

Joel Coehoorn
My project is set to any, however, the setup does not allow that option. A Setup Project the property TargetPlatform and I have the option of x86, x64 and Itanium. There is not an any.
Malfist
Hmm.... the setup projects include a native .exe file to bootstrap the install in case .Net is not yet present. That may be the limiting factor.
Joel Coehoorn
In that case, could you test with a 32-bit (x86) setup project that includes both sets of dlls? The setup project should still run on x64 and x86 systems, and if things work out right you might still get the x64 code where appropriate.
Joel Coehoorn
The setup won't compile targeting x86. Only targeting x64. (fails with the errors I stated in my question.)
Malfist
Hmm... you ought to be able to get it to treat those files as just 'content' rather than code somehow, but setup projects aren't something I need to play with often enough to know how.
Joel Coehoorn
I can't keep it from treating it as an assembly, even if I add it as a 'file'
Malfist
+1d. For more info around this, see http://blogs.msdn.com/rmbyers/archive/2009/06/8/anycpu-exes-are-usually-more-trouble-then-they-re-worth.aspx
Ruben Bartelink
+3  A: 

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.

Magnus Johansson
I didn't want to have to do this...
Malfist