G
Grant Schenck
Hello,
I'm pretty new to both COM and C#/.Net so assume I'm an idiot and you won't
be far off the mark!
I built an STA COM object using VC 6.0. I build a number of applications
which use the object in C++ & VB 6.0. It all works well.
I was able to write a test application using C# and use my object. All I
had to do was add a reference to the object and then I was free to declare
it.
Specifically, my object shows up in C# as a reference to "STControlLib".
I can then do a:
"using STCONTROLLib;"
I can then declare an instance of an object and use it:
private Ctl STCtl
STCtl.Initialize();
Now, I am working on a larger .Net application developed by another party (I
do have the source for it and am able to build it just fine.)
I wanted to use my COM object from this project so I added a reference.
However, when I go to build it it fails with:
C:\Depot\Source\main\Tools\DesktopSDK\STAPI2\Setup\Setup.vdproj File
'STControl.dll' cannot be shared in Global Assembly Cache folder; only
assemblies are allowed.
C:\Depot\Source\main\Tools\DesktopSDK\STAPI2\Setup\Setup.vdproj Assembly
'Primary output from sforcePhoneBar (Active)' cannot be in the Global
Assembly Cache because its dependency 'Interop.STCONTROLLib'
(Version='1.0.0.0') is not strongly named.
So, I read up on "strong named" issues. Sure enough the C# based solution
I'm building has entries like this:
[assembly: AssemblyKeyFile(@"..\..\..\BandObjects.snk")]
So, I figured I need to do something like:
tlbimp.exe" -keyfile:\depot\source\main\tools\desktopsdk\stapi2\bandobjects.
snk STControl.tlb
That creates a file called
STControlLib.dll
However, the C# build still fails with the same error.
So, I'm thinking that somehow I need to reference the COM object differently
then using a reference...?
Bottom line is I'm looking for a simple process to be able to actually use
the object.
Thanks!
I'm pretty new to both COM and C#/.Net so assume I'm an idiot and you won't
be far off the mark!
I built an STA COM object using VC 6.0. I build a number of applications
which use the object in C++ & VB 6.0. It all works well.
I was able to write a test application using C# and use my object. All I
had to do was add a reference to the object and then I was free to declare
it.
Specifically, my object shows up in C# as a reference to "STControlLib".
I can then do a:
"using STCONTROLLib;"
I can then declare an instance of an object and use it:
private Ctl STCtl
STCtl.Initialize();
Now, I am working on a larger .Net application developed by another party (I
do have the source for it and am able to build it just fine.)
I wanted to use my COM object from this project so I added a reference.
However, when I go to build it it fails with:
C:\Depot\Source\main\Tools\DesktopSDK\STAPI2\Setup\Setup.vdproj File
'STControl.dll' cannot be shared in Global Assembly Cache folder; only
assemblies are allowed.
C:\Depot\Source\main\Tools\DesktopSDK\STAPI2\Setup\Setup.vdproj Assembly
'Primary output from sforcePhoneBar (Active)' cannot be in the Global
Assembly Cache because its dependency 'Interop.STCONTROLLib'
(Version='1.0.0.0') is not strongly named.
So, I read up on "strong named" issues. Sure enough the C# based solution
I'm building has entries like this:
[assembly: AssemblyKeyFile(@"..\..\..\BandObjects.snk")]
So, I figured I need to do something like:
tlbimp.exe" -keyfile:\depot\source\main\tools\desktopsdk\stapi2\bandobjects.
snk STControl.tlb
That creates a file called
STControlLib.dll
However, the C# build still fails with the same error.
So, I'm thinking that somehow I need to reference the COM object differently
then using a reference...?
Bottom line is I'm looking for a simple process to be able to actually use
the object.
Thanks!