使用.Net 4加载QuickTime Control时出错 [英] Error loading QuickTime Control with .Net 4

查看:64
本文介绍了使用.Net 4加载QuickTime Control时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#dll,我已经建立了几年,它对我们的核心技术有广泛的支持。我几个月前在VS 2008中使用.net 2添加了QuickTime控件。最近我转向VS 2010,现在需要使用.net 4构建,因为它依赖于我们核心技术的另一部分。当我对.net 4进行更改时,我收到以下错误。



错误557无法加载文件或程序集'Interop.QTOLibrary,Version = 1.0 .0.0,Culture = neutral,PublicKeyToken = null'或其依赖项之一。该系统找不到指定的文件。



我在quicktime dll上运行了depends.exe,我在加载库时出现以下问题。



GPSVC.dll

IESHIMS.dll

COMCTL32.dll

IEFRAME.dll

SHLWAPI。 dll



我有点困惑为什么quicktime dll正确加载项目设置为.Net 2或3.5,但不会加载.net 4。有没有人对这个问题有什么想法?



:confused:



TIA。 Scott

I've got a C# dll that I've been building for over a couple of years and it has a wide range of support for our Core technology. I added the QuickTime control several months ago in VS 2008 using .net 2. Recently I've move to VS 2010 and now need to build with .net 4 because of dependency with another part of our core technology. When I make the change to .net 4, I'm getting the following error.

Error 557 Could not load file or assembly 'Interop.QTOLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

I ran depends.exe on the quicktime dll and I'm getting the following issues with loading the library.

GPSVC.dll
IESHIMS.dll
COMCTL32.dll
IEFRAME.dll
SHLWAPI.dll

I'm a little confused why the quicktime dll was loading properly with the project set to .Net 2 or 3.5, but will not load with .net 4. Does anyone have any ideas of what could be causing this problem?

:confused:

TIA. Scott

推荐答案

我遇到了一个类似的问题,即使用嵌入式quicktime控件构建一个新应用程序。在玩完所有内容之后,我终于通过将QTOLibrary.dll和QTOControlLib.dll的嵌入互操作类型更改为false来使其工作。



显然,它看起来很像像ActiveX控件无法正确嵌入互操作类型:



无法从程序集'AxInterop.QTOControlLib'中嵌入互操作类型,因为它缺少'ImportedFromTypeLib'属性或'PrimaryInteropAssembly'属性。



因此,一旦你将QTOLibrary和QTOControlLib更改为不嵌入互操作,ActiveX控件就能够定位和库文件并加载正确。



每个Microsoft,从.NET Framework 4开始,公共语言运行库支持将COM类型的类型信息直接嵌入到托管程序集中,而不是需要托管程序集从互操作程序集中获取COM类型的类型信息。因为嵌入的类型信息只包含t他键入和托管程序集实际使用的成员,两个托管程序集可能具有相同COM类型的非常不同的视图。每个托管程序集都有一个不同的Type对象来表示其COM类型的视图。公共语言运行库支持接口,结构,枚举和委托的这些不同视图之间的类型等效



http://msdn.microsoft.com/en-us/library/dd997297.aspx [ ^ ]



我还没有发现改变这个设置会产生什么其他的复杂情况,但到目前为止,它看起来像一个魅力,并一直稳定。



我不知道这是否帮助与否,但它可能指向正确的方向:)



谢谢,



A
I ran into a similar issue building a new application with the embedded quicktime control. After playing around with everything, I finally got it to work by changing the embed interop type for the QTOLibrary.dll and QTOControlLib.dll to false.

Apparently, it looks like the ActiveX control cannot embed the interop type correctly:

"Cannot embed interop types from assembly 'AxInterop.QTOControlLib' because it is missing either the 'ImportedFromTypeLib' attribute or the 'PrimaryInteropAssembly' attribute."

So, once you change the QTOLibrary and QTOControlLib to not embed the interop, the ActiveX control is able to locate and library file and load correctly.

Per Microsoft, "Beginning with .NET Framework 4 , the common language runtime supports embedding type information for COM types directly into managed assemblies, instead of requiring the managed assemblies to obtain type information for COM types from interop assemblies. Because the embedded type information includes only the types and members that are actually used by a managed assembly, two managed assemblies might have very different views of the same COM type. Each managed assembly has a different Type object to represent its view of the COM type. The common language runtime supports type equivalence between these different views for interfaces, structures, enumerations, and delegates"

http://msdn.microsoft.com/en-us/library/dd997297.aspx[^]

I have yet to discover what other complications will arise from changing this setting, but so far it seems to work like a charm and has been stable so far.

I am not sure if this helps you or not, but it might point you in right direction :)

Thanks,

A


你能确定以下内容是真的:



1)你引用的DLL正被复制到输出目录。

2)项目中的引用不需要特定版本(在解决方案资源管理器中选择参考后检查您的属性窗口。



干杯。
Can you make sure that the following are true:

1) The DLL you're referencing is being copied to the output directory.
2) The reference in the project doesn't require a specific version (check your properties window after selecting the reference in the solution explorer).

Cheers.


1)是的,它正在复制本地。

2)我不确定它是否需要特定版本。我查看了属性窗口,但我仍然不确定。物业窗口内容如下:



(名称)Interop.QTOControlLib

CopyLocal True

Culture 0

说明Apple QuickTime Control 2.0

嵌入互操作类型为真

文件类型活动X

身份{Guid} \ 1.0 \\\\tlbimp

隔离错误

路径C:\Develop\ .... \obj\Debug\Interop.QTOControlLib.dll

已解决True

强名称错误

版本1.0.0.0



谢谢,

Scott
1) Yes, it is being copied local.
2) I'm not sure if it's requiring a specific version or not. I looked in the properties window, but I'm still not sure. Property window contents are listed below.

(Name) Interop.QTOControlLib
CopyLocal True
Culture 0
Description Apple QuickTime Control 2.0
Embed Interop Types True
File Type Active X
Identity {Guid}\1.0\0\tlbimp
Isolated False
Path C:\Develop\....\obj\Debug\Interop.QTOControlLib.dll
Resolved True
Strong Name False
Version 1.0.0.0

Thanks,
Scott


这篇关于使用.Net 4加载QuickTime Control时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆