0

I'm working on a solution consisting of multiple projects (including some external 3rd party libraries). The solution has a setup project, that installs (non-custom) prerequisites, which by default comes with x86 and x64 versions (together in 1 prerequisite). Projects within the solution have target platform set to x86 (in project properties, not on configuration selector) due to BadImageFormatException, from unknown source.

My problem is that when I use the installer on a 64bit machine, the 64bit version of prerequisite is installed, which leads to errors saying I should use correct (which is x86) version of prerequisite.

I was wondering if I can force a particular version of prerequisite using a setup project.

EDIT/UPDATE: Since my question seems to generate a lot of confusion, I've decided to post 2 screenshots, that will hopefully explain more.

enter image description here ==> enter image description here

This includes both packages and I don't know of a way to to separate them. As for the error, it is a generic error for software version mismatch (something in lines of "Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required. "). Unfortunately, I cannot screenshot the error, as I won't have access to the "clean" PC for a while. I get it if I use 64 bit redistributable pack (because project that uses it is 32bit), I don't get it If I use 32 bit redistributable pack, so effectively, If I can force installer to select the 32bit package, my problem is solved.

Zero
  • 1,562
  • 1
  • 13
  • 29
  • It is not clear why you allow it to copy a 64-bit dependency at all. Since it is never going to work. – Hans Passant Apr 05 '17 at 14:30
  • It's a prerequisite that (automatically) includes both installers. – Zero Apr 05 '17 at 14:33
  • Well, sounds like you don't like it much. There is somebody at the other end of a telephone line that *might* have an idea what you are talking about. We don't, you didn't tell us anything about it. – Hans Passant Apr 05 '17 at 14:39
  • Ah, right, my wording in the question might not be clear enough. I selected a prerequisite for the setup project from default list (not a custom one) and that option automatically includes both installers with setup. I don't "allow" it to copy 64 bit dependency - It is just bundled together with 32 bit one and I don't know of a way to separate them. – Zero Apr 05 '17 at 15:06
  • I think you need to say what the prerequisite actually is, and exactly where the error message comes from about " should use correct (which is x86) version of prerequisite". And if this is really a VS 2008 setup project you could try VS 2015 with the installer extension. – PhilDW Apr 05 '17 at 20:46

1 Answers1

0

This question remains unanswered, in essence.

I solved my problem by locating the 1 library that was build for 32bit platform (for no particular reason, as it turns out) and getting it rebuilt in with target platform set to "Any CPU" (same as the rest of the project), which in turn allowed me to use the 64bit redistributable package that is chosen automatically (instead of forcing a 32bit one, as I initially intended).

An answer to this question features a PowerShell command which checks assembly info (and target CPU architecture), which is what I used to check each of eternal libraries in my project and locate the one that's build as x86.

Community
  • 1
  • 1
Zero
  • 1,562
  • 1
  • 13
  • 29