简体   繁体   中英

Can't register .dll with RegAsm in Windows 7

I am trying to use the QuickTime 2.0 ActiveX plugin for a winforms application written in C#.

Firstly I drag the object from my toolbox to the form but I get an error saying that the ActiveX control can not be imported and to check that it is registered correctly. Under the references header of the solution explorer the AxQTOControlLib reference shows as failed.

In order to attempt to solve this (after searching for solutions) I have used AxImp to create the relevant C# wrapper for the control from the QTOControl.dll that is in the QuickTime programme file.

I then attempt to register the .dll with the system by using RegAsm, however when I do this I get the following error:

"RegAsm : error RA0000 : Could not load file or assembly 'QTOControlLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."

I have checked and the file definitely exists and the path is correct.

Please can you help with how to solve this issue, so that the .dll can be registered and the QuickTime ActiveX controller can be used in the winforms application.

I am using the following setup:

Windows 7 (64bit) Visual Studios 2010 .Net 4.0

The DLL created by AxImp doesn't need to be registered with RegAsm. The QTOControlLib.dll does not expose any COM objects, it merely contains the wrappers required to use the QuickTime com objects from .Net. Just copy the DLL's generated by AxImp into your solution directory and add a reference to them in Visual Studio.

MJ - I am having the same problem, and I did finally figure out the answer: This issue occurs with VS2010 when you attempt to move the Apple QuickTime Control 2.0 ActiveX COM object from the Toolbox to the WinForm only when you are targeting .NET 4.0. If you go back to .NET 3.5 or earlier it works fine. The way to fix the problem is to manually copy AxInterop.QTOControlLib.dll to the project ../obj/x86/Debug or /Release folders prior to attempting to move the Apple Quicktime Control 2.0 object to the WinForm. There is a Microsoft KB Article ID: 2066987 (Visual Studio Hotfix Patch). If you do a Rebuild appname from the build menu, you will get the same error - "Could not load file or assembly 'Interop.QTOLibrary, Version=1.0.0.0...". In that case Just put AxInterop.QTOControlLib.dll back in the ../obj/x86/Debug /Release directories and do a normal Build (Shift+F6). What happens is a Rebuild/Clean removes the AxInterop.QTOControlLib.dll from the ../obj/x86/Debug /Release directory which causes this problem. Again KB2066987 hotfix apparently addresses this exact problem. You have to ask Microsoft support for this hotfix; I have put in a request to Microsoft support for the KB2066987 hotfix and should receive it today.

Solution to install Apple Quicktime Control 2.0 in Visual Studio 2010 onto a WinForm

A. Set Project properties to Target .NET Framework 3.5 if allowed

B. If you need to Target .NET 4.0 then you have the following two choices:

  1. You can manually copy AxInterop.QTOControlLib.dll to the project ../obj/x86/Debug or /Release folders prior to attempting to move the Apple Quicktime Control 2.0 object to the WinForm see my answer above that has more detail.

  2. You can obtain the a hotfix from Microsoft; reference KB Article Number 206697. I have received and installed the hotfix and it does solve the problem. Note you have to request this hotfix from MS support.

Neal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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