.net – NUnit “missing” GPSVC.DLL on Windows 7/64

32bit-64bitdependenciesdllnetx86-64

I recently upgraded from Vista/32 to Win7/64. On my old machine, everything was working fine.

Unfortunately, on my new machine NUnit won't load my unit tests, with the error message "System.IO.FileNotFoundException: Could not load file or assembly 'UnitTest' or one of its dependencies. The system cannot find the file specified". (Actually, I had to go through all of my solution's projects and set them to 32-bit to get this far.)

So I loaded up Dependency Walker, and it told me that I was missing IESHIMS.DLL. I found two on my machine, so I copied in the 32-bit version from the Internet Explorer directory, and DW stopped complaining about that file.

However, it's also missing GPSVC.DLL. I found only one copy of this in C:\Windows\System32, but when I copy that into my unit test directory, DW complains that it's 64-bit, and NUnit still won't run. It also now adds SYSNTFY.DLL to the missing list. I've only got one of those, and that's also 64-bit. NUnit still reports an error.

So should I scrap this 64-bit OS and go back to good-old 32-bit, or am I missing something obvious?

Best Answer

I hit the same problem today, luckily there is a very simple fix and a more complex one.

The simple fix is to run nunit-console-x86.exe, instead of nunit-console.exe

The difficult fix with a partial explanation is:

What is happening is the nunit console runner is running in 64bit mode, which somehow stops it from loading your unit test dlls which are in 32 bit mode.

The fix is made to the nunit console exe, you tell windows to force it to run in a 32 bit compatibility mode. This link shows you how to do it.

NB, you will need to download a windows sdk as well to get the corflags.exe, remember to run the command from the SDK command prompt.

Related Topic