views:

79

answers:

2

I'm really hoping someone's seen this before, because I'm dying on this one.

I have tried compiling the service exe as AnyCPU, x86, and x64 It works on my win 7 x64 box I'm installing with installutil, the .net 4 version

When I start the service, I get an error. It says nothing, but does point to which modules are loaded. Those of potential interest:

LoadedModule[0]=D:\yellowbook\grapevine_service\grapevinesystemservice.exe LoadedModule[3]=C:\Windows\system32\KERNEL32.dll LoadedModule[4]=C:\Windows\system32\KERNELBASE.dll LoadedModule[9]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll LoadedModule[17]=C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll LoadedModule[18]=C:\Windows\WinSxS\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4927_none_88dce9872fb18caf\MSVCR80.dll LoadedModule[22]=C:\Windows\assembly\NativeImages_v2.0.50727_64\mscorlib\9a017aa8d51322f18a40f414fa35872d\mscorlib.ni.dll

I can run this service as a console app w/ a cmd line switch, which yields this:

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'grapevinesystemservice.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. File name: 'grapevinesystemservice.exe'

I've tried to the registry hack to force the use of the latest runtime. No effect. I've looked at the installed exe in reflect to make sure it didn't get munged by my buildserver, but it's targeted at 4.0.30319. My local, build, and test server all have 30319 as the .net 4 version. None ever had a beta/RC.

Sure could use some help on this one.

They weren't listed in the load modules, but I am also using log4net (rebuilt in .net 4 from src), structuremap, Norm (MongoDB), AutoMapper, Newtonsoft.Json, and a number of other dlls that were built by my team.

+3  A: 

One of your dependent dlls is not compiled with AnyCpu. See here for details on how to check them.

David Lynch
Reflector provides this information as well, and every dll that was deployed with the project is set to Any. (I recompiled as x86 to make sure reflector was working properly)
Jeff D
Thank you for the answer though. I think it's got to be something along these lines. I'll use the tools referenced there as well shortly.
Jeff D
+2  A: 

Have you tried setting requiredRuntime in the config file for grapevinesystemservice.exe? Like 0xA3 mentioned, it looks like it isn't set to use 4.0.

<startup>
  <requiredRuntime version="v4.0.20506" safemode="true"/>
</startup>
eschatonizer
Looking promising... somehow, my config was altered to be 2.0 somewhere along the way. (It's set to 4 locally). Fixing this and running gave me an error that implied the framework wasn't installed... It is... I'm trying to run a repair against it now. Definitely some movement though. Nice one eschatonizer!
Jeff D
Ok, that was it. Man, I wouldn't have gotten around to checking that for awhile. Thanks. Now to go figure out why it's being changed...
Jeff D