简体   繁体   English

VS 2003 在后期构建期间无法注册 regsvr32。 命令提示符没有问题

[英]VS 2003 fails to regsvr32 during post build. No issues from command prompt

Regsvr32 fails as a post build event for a DLL project. Regsvr32 作为 DLL 项目的构建后事件失败。

Post Build Event: regsvr32 /s /c "$(TargetPath)" (also tried without quotes).生成后事件:regsvr32 /s /c "$(TargetPath)"(也尝试不带引号)。

Removing the /s results in the error message LoadLibrary("...") failed - The specified module could not be found.删除 /s 会导致错误消息 LoadLibrary("...") 失败 - 找不到指定的模块。

If I run regsvr32 from command prompt the result is successful.如果我从命令提示符运行 regsvr32,结果是成功的。 If I copy and run or even directly run the "BAT000019.bat" file I get the resulting message "DllRegisterServer in...dll succeeded."如果我复制并运行甚至直接运行“BAT000019.bat”文件,我会收到结果消息“DllRegisterServer in...dll 成功”。 I have loaded the DLL in Dependency Walker and found no issues.我已经在 Dependency Walker 中加载了 DLL,没有发现任何问题。 This has worked in the past, but suddenly started having issues.这在过去有效,但突然开始出现问题。 I have about 50 projects which have the same post build event, only about 3 have this issue.我有大约 50 个项目具有相同的后期构建事件,只有大约 3 个有这个问题。 The DLL file does exist at the time the bat file is generated (maybe it's in use???).生成bat文件时DLL文件确实存在(也许正在使用???)。

I don't see any issues with the generated bat file:我没有看到生成的 bat 文件有任何问题:

@echo off
regsvr32 /c "C:\ ... .dll"
if error level 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "Performing registration"
exit 1
:VCEnd

Other information: OS: Windows XP SP3.其他信息:操作系统:Windows XP SP3。 IDE: VS 2003 Pro (up to date). IDE:VS 2003 Pro(最新)。 Language: C++语言:C++

I could just remove the post build event, but would rather keep it for some of our newer program debuggers.我可以只删除构建后事件,但宁愿为我们的一些较新的程序调试器保留它。

Anyone have any thoughts on how to fix this?有人对如何解决这个问题有任何想法吗?

Other things I've tried: Relative path to DLL in post build event.我尝试过的其他事情:构建后事件中到 DLL 的相对路径。 (fails) Absolute path to DLL in post build event. (失败)在构建后事件中指向 DLL 的绝对路径。 (fails) With an without quotes (nothing in the absolute path contains a space). (失败)不带引号(绝对路径中没有任何内容包含空格)。 (fails) (失败)

I think your project isn't made by just one DLL, maybe the DLL you're building depends on other libraries (check with DependencyWalker andverify if LoadLibrary / GetProcAddress too) but they're not there for the post-build event of the dll.我认为您的项目不仅仅是由一个 DLL 制作的,也许您正在构建的 DLL 取决于其他库(检查 DependencyWalker 并验证LoadLibrary / GetProcAddress是否也是如此)但它们不存在于 dll 的构建后事件.

If you run from the command prompt in the output directory there is everything your dll needs so it can be registered.如果您从 output 目录中的命令提示符运行,那么您的 dll 就可以注册所需的一切。

For what I know you can't set a post-build event for the solution so please check your project dependencies/build order).据我所知,您无法为解决方案设置构建后事件,因此请检查您的项目依赖项/构建顺序)。 I assume you're not trying to register a dll alone in its output directory without its dependencies (the path in the batch should match $(TargetPath) )我假设您没有尝试在其 output 目录中单独注册一个 dll 而没有其依赖项(批处理中的路径应匹配$(TargetPath)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM