只是我,还是
Mt.exe
-dll
选择?
在VisualStudio 2008中,我有一个VisualC++项目,它引用了一个孤立的(无注册的)COM DLL。我使用预生成事件将COM DLL复制到项目的输出目录中。在项目属性中,在“配置属性”>“清单工具”>“独立COM”对话框中,我使用了以下设置:
Type Library File: $(OutDir)\MyCom.tlb
Registrar Script File:
Component File Name: $(OutDir)\MyCom.dll
Replacements File:
Visual Studio向我显示生成的命令行命令:
mt.exe /nologo
/tlb:"C:\[ ... snip ... ]\OtherProject\Release\MyCom.tlb"
/dll:"C:\[ ... snip ... ]\OtherProject\Release\MyCom.dll"
/outputresource:"..\Release\OtherProject.exe;#1"
它构建得很好,但是我得到一个运行时FileNotFound异常。应用程序找不到MyCom.dll!改变
Component File Name
到以下相对路径工作正常:
Component File Name: ..\$(ConfigurationName)\MyCom.dll