TlbExp.exe 错误:此程序集是由较新的运行时构建的
我们正在将部分服务器迁移到 .net 4.0。作为第一步,我们已经迁移到 Vs2010,但没有更改任何项目的目标框架。
第二步,我将服务器的特定部分移动到目标 4.0,以便我们可以使用一些新功能。
在针对 4.0 的类库 DLL 上调用 TLBexp.exe 时,我遇到了问题。这个DLL还引用了很多面向2.0的DLL。
我收到错误:TlbExp:错误 TX0000:无法加载文件或程序集“file:Library.dll”或其依赖项之一。该程序集是由比当前加载的运行时更新的运行时构建的,无法加载。
我调用的是自带的TLBExp:Microsoft SDKs\Windows\v7.0A\bin\ 在我在 VS2010 命令提示符中调用的命令中,我引用了 v4.0.30319 二进制文件(例如 mscorlib.tlb)
是否允许在引用 2.0 库的 4.0 DLL 上运行 TLB? 如果是,那么我收到此错误的任何原因。
这是我使用的确切命令调用: "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\tlbexp.exe" /silent /win32 /tlbreference:"C:\Windows\Microsoft.NET\Framework\ v4.0.30319\mscorlib.tlb" /tlbreference:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.tlb" /tlbreference:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.tlb" /tlbreference:"C:\Windows\system32\stdole2.tlb" C:\Dev\Library.dll
谢谢
We are moving part of our server to .net 4.0. We already did the move to Vs2010 as a first step but did not change the target framework of any project.
As a second step I'm moving a specific part of our server to target 4.0 so we can use some of the new functionality.
I've run into a problem when calling TLBexp.exe on a Class library DLL that targets 4.0. This DLL also references a lot of DLLs that target 2.0.
I get the error: TlbExp : error TX0000: Could not load file or assembly 'file:Library.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I am calling the TLBExp that comes with: Microsoft SDKs\Windows\v7.0A\bin\
In the command I call in the VS2010 command prompt I reference v4.0.30319 binaries (such as mscorlib.tlb)
Is running TLB on a 4.0 DLL that references 2.0 libraries allowed?
If yes then any reason why I'm getting this error.
Here is the exact command call i use: "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\tlbexp.exe" /silent /win32 /tlbreference:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.tlb" /tlbreference:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.tlb" /tlbreference:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.tlb" /tlbreference:"C:\Windows\system32\stdole2.tlb" C:\Dev\Library.dll
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有一个目标为 4.0 的程序集,它引用了另一个目标框架为 3.5 的程序集。
结果,我在“构建后”步骤中遇到了相同的错误。通过反复试验,我发现在这个文件夹中找到的 TLBExp 版本:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\
可以生成TLB 文件成功。哈!
I had an assembly targeting 4.0, that referenced another assembly which had a target framework of 3.5.
As a result, I was getting the same error on a "post build" step. By trial and error, I discovered that the version of TLBExp found in this folder:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\
could generate the TLB file successfully.HTH!
您可以使用以下 TlbExp 路径,该路径将根据项目框架版本自动获取:
You can use the following path to TlbExp, which will be picked up automatically based on project framework version: