This is a followup to this question:
NGEN x86 vs x64 with .NET executables
I know that it's possible to NGEN using a custom setup action, but I use Inno Setup, so I have to do it manually.
The question: if my assembly is compiled in x86 mode, should I always use x86 version of ngen.exe, or depending on the OS (x86 ngen.exe on x86 Windows and x64 ngen.exe on x64 Windows)?
The problem is that I'm getting the following errors with NGEN installation:
Compiling assembly C:\Program Files\MyApp\MyApp.exe (CLR v4.0.30319) ... 01/15/2012 15:05:28 [2432]: 1>Error compiling C:\Program Files\MyApp\MyApp.exe: This version of is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher. (Exception from HRESULT: 0x800700D8)
Ideally, I'd like to compile into native code the main assembly (x86) and all its dependencies (mixed x86 and AnyCPU builds).
Please advise.
I had the same problem when i tried to compile
MyApp.exe
withNGEN
in AnyCPU mode. . . Then I switched x64 mode and it worked