none
how to replace an interop dll in an application RRS feed

  • Question

  • I have created Interop and AxInterop dll by using MyConstObjects.dll and the Interops were called Interop. MyConstObjects.dll & AxInterop. MyConstObjects.dll . I am refering these three dlls in my application. Now I want to rplace MyConstObjects with MyObjects .

    To do the same without any code change I have created Interop dlls as given below

    set tpath=C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin
    set constCtrlDll="C:\Vidya\MyObjects.dll” 
    rem Instead of MyConstObjects I referred MyObjects and created the interop with same name
    "%tpath%\TlbImp.exe" %constCtrlDll% /asmversion:13.0.0.0 /keyfile:keyFile.snk  /namespace:MyConstObjects /out: MyConstObjects.dll
    "%tpath%\AxImp.exe" %constCtrlDll% /keyfile:keyFile.snk /rcw: MyConstObjects.dll  /out:AxInterop. MyConstObjects.dll
    pause
    

    After creating new interop dlls I have replaced the old dlls , which I created using MyConstObjects.But now I am getting the following error while compiling the application:

    The type or namespace name 'IMyConstObjectsEvents_DblClickEvent' could not be found (are you missing a using directive or an assembly reference?)

    Solution for the above error is to replace 'IMyConstObjectsEvents_DblClickEvent’ with 'IMyObjectsEvents_DblClickEvent’

    The above change is required in more than hundred places to make my application error free. I would like to know is there any way to replace the Interop.MyConstObjects with Interop.MyObjects without any code change? I mean is there any way to rename 'IMyObjectsEvents_DblClickEvent' to 'IMyConstObjectsEvents_DblClickEvent' while generating the Interop dll. So that I can avoid code change in my application?

    Regards,

    Vidya


    Tuesday, May 8, 2012 6:57 PM

Answers