Strong Named AxInterop: needs OCX in same directory ?

  • Thread starter Thread starter Sameer
  • Start date Start date
S

Sameer

I decided to strong name the axhost generated when I inserted the an
activex control in my windows form. To this end...

1. Created Interop Interop.MyAnalogLibrary.dll
tlbimp \winnt\system32\MyAnalogLibrary.ocx
/out:Interop.MyAnalogLibrary.dll /keyfile:..\..\1.snk

2. Created AxInterop AxInterop.MyAnalogLibrary.dll
aximp \winnt\system32\MyAnalogLibrary.ocx
/out:AxInterop.MyAnalogLibrary.dll /rcw:Interop.MyAnalogLibrary.dll
/keyfile:..\..\1.snk

3. GAC'ed them both by dragging them into \winnt\assembly. They have
assembly version 1.0.0.0

4. Overwrote the weak named references to the above two files in my C#
project. Looked in the reference property window and found that the
new references had strongname property == true and CopyLocal == false.
Code compiled OK.

5. Deleted all local copies of the *AnalogLibrary.dll from my working
directory /CSharp/StrongName/bin/Debug. Double-clicked on the
executable /CSharp/StrongName/bin/Debug/StrongName.exe

Problem
-------
Code crashed with a FileNotFoundException on the following line-
((System.ComponentModel.ISupportInitialize)(this.axiKnobX1)).EndInit();

axiKnobX1 was an OCX control

UNLESS

I copy the original OCX (MyAnalogLibrary.ocx) into the same folder as
StrongName.exe Why ??? I have \winnt\system32 in my environment
variable PATH (typing path at the DOS prompt in the directory shows
\winnt\system32)

Thanks for taking time to read this. This may have been more
information than you needed to know.

-S-
 
Back
Top