.net Windows 7/64 上的 NUnit“缺少”GPSVC.DLL

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1877098/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 13:39:08  来源:igfitidea点击:

NUnit "missing" GPSVC.DLL on Windows 7/64

.netdlldependencies32bit-64bitx86-64

提问by Mike Hanson

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

我最近从 Vista/32 升级到 Win7/64。在我的旧机器上,一切正常。

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

不幸的是,在我的新机器上,NUnit 不会加载我的单元测试,并显示错误消息“System.IO.FileNotFoundException:无法加载文件或程序集 'UnitTest' 或其依赖项之一。系统找不到指定的文件”。(实际上,我必须浏览我所有解决方案的项目并将它们设置为 32 位才能达到此目的。)

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.

所以我加载了 Dependency Walker,它告诉我我缺少IESHIMS.DLL。我在我的机器上发现了两个,所以我从 Internet Explorer 目录中复制了 32 位版本,并且 DW 停止抱怨该文件。

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.DLLto the missing list. I've only got one of those, and that's also 64-bit. NUnit still reports an error.

但是,它也缺少GPSVC.DLL。我在 C:\Windows\System32 中只找到了一个副本,但是当我将它复制到我的单元测试目录中时,DW 抱怨它是 64 位的,并且 NUnit 仍然无法运行。它现在还将 SYSNTFY.DLL添加到缺失列表中。我只有其中一个,而且也是 64 位的。NUnit 仍然报错。

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

那么我应该放弃这个 64 位操作系统并回到旧的 32 位操作系统,还是我错过了一些明显的东西?

采纳答案by Noel Kennedy

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

简单的修复是运行 nunit-console-x86.exe,而不是 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.

发生的事情是 nunit 控制台运行程序在 64 位模式下运行,这以某种方式阻止它加载 32 位模式下的单元测试 dll。

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

修复是对 nunit 控制台 exe 进行的,您告诉 Windows 强制它以 32 位兼容模式运行。此链接向您展示了如何操作。

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.

注意,您还需要下载一个 windows sdk 来获取 corflags.exe,记得从 SDK 命令提示符运行该命令。

回答by Michael Mullan

Windows has a 64-bit command prompt, but you can get a 32-bit one by starting c:\windows\syswow64\cmd.exeexplicitly. From there you can call c:\windows\syswow64\regsvr32.exeand the registration will succeed.

Windows 有 64 位命令提示符,但您可以通过c:\windows\syswow64\cmd.exe显式启动来获得 32 位命令提示符。从那里你可以打电话c:\windows\syswow64\regsvr32.exe,注册会成功。

回答by Mike Hanson

The only way I could get it to work was to convert my entire application to 32-bit target, and test it on a 32-bit virtual machine. Also, the DLLs had to be on a local (non-network) drive, because debugging is not permitted on network drives (at least I wasn't able to get it to work).

我让它工作的唯一方法是将我的整个应用程序转换为 32 位目标,并在 32 位虚拟机上测试它。此外,DLL 必须位于本地(非网络)驱动器上,因为网络驱动器上不允许调试(至少我无法让它工作)。