The best technique is setting the GUID/IID/CLSID's using the GuidAttribute. However, a recompile with no changes does not cause the guids to change. In fact, I just tested that to make sure the docs were correct. I recompiled your code below numberous times without making any changes to the source and the generated GUIDs were always the same.
-- Brent Rector, .NET Wise Owl Demeanor for .NET - an obfuscation utility http://www.wiseowl.com/Products/Products.aspx -----Original Message----- From: Patrick Burrows [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 10:16 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] COM Interop calling a C# DLL from VB6 Also, it seems better to have all your classes implement an interface, and then use those interfaces for the TypeLibs. Question: Is the compiler at this point handling all the binary compatibility issues? If I have a DLL and it implements an interface like the code pasted below. It will generate the TypeLibrary just fine and I can use that from VB6 without any issues. It works great, in fact. If I then compile a second time (without making any changes in code--just two compiles in a row), the references from within my VB6 app are broken, and, indeed, the uuids are different. public interface ICMyTest { DateTime AddTwoHoursFromNow(); } [ClassInterface(ClassInterfaceType.None)] public class CMyTest : ICMyTest { public CMyTest() { } public DateTime AddTwoHoursFromNow() { //adds two hours to whatever the current time is and returns that value DateTime dtCurTime = DateTime.Now; return dtCurTime.AddHours(2); } } Is there a way to set a binary compatible reference? Patrick Burrows Well I woke up this morning With the cold water -------------------- Now Playing: willie joe - unitar rock.mp3 (patcast) -------------------- > -----Original Message----- > From: Sam Gentile [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 31, 2002 12:24 PM > To: [EMAIL PROTECTED] > Subject: Re: COM Interop calling a C# DLL from VB6 > > > The .snk files are only key files generated and used when you > are signing > and generating a Strong Name. As Brent said, you only need a > Strong Name > when putiing Inetrops in the GAC. This is not neccessary to > call .NET code > from COM. Some examples show it that way but it is 100% not > required. You > can perfectly use Private assemblies as long as they are in > the right place > (also as Brent said). > > > >From: Patrick Burrows <[EMAIL PROTECTED]> > >Reply-To: dotnet discussion <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Re: [DOTNET] COM Interop calling a C# DLL from VB6 > >Date: Fri, 31 May 2002 11:30:55 -0400 > > > >FWIW, I just found > >http://www.codeproject.com/dotnet/cominterop.asp#PART2 > > > >Which seems to be a very good and detailed discussion of doing COM > >interop. I'm about to sit down and read it, but from the > sample I just > >looked at, there is nothing in there at all about needing .SNK files. > > > >Patrick Burrows > >In this sinking board walk town > >-------------------- > >Now Playing: no artist - audiotrack 11 (patcast) > >-------------------- > > > > > > > > > -----Original Message----- > > > From: Brent E. Rector [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, May 31, 2002 11:11 AM > > > To: [EMAIL PROTECTED] > > > Subject: Re: COM Interop calling a C# DLL from VB6 > > > > > > > > > The docs are wrong when the claim a .NET assembly used > via COM interop > > > must have a strong name. As you state, they only need a > strong name in > > > order to be added to the GAC. As long as you understand > the assembly > > > search rules, you can use an assembly via COM interop > (i.e. by a COM > > > client) by placing the assembly in the client's private assembly > > > search path. > > > > > > -- Brent Rector, .NET Wise Owl > > > Demeanor for .NET - an obfuscation utility > > > http://www.wiseowl.com/Products/Products.aspx > > > > > > > > > > > > -----Original Message----- > > > From: Richard Birkby [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, May 31, 2002 7:41 AM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [DOTNET] COM Interop calling a C# DLL from VB6 > > > > > > > > > COM classes are globally registered in the Registry. To > do this, they > > > need a unique ID - a GUID. > > > > > > By default, .Net classes are not globally registered. To > do this, you > > > must place the assembly in the GAC (the equivalent of the > > > registry) and > > > give it a strong name (the equivalent of a GUID). > > > > > > > > > Richard > > > > > > > -----Original Message----- > > > > From: dotnet discussion > > > [mailto:[EMAIL PROTECTED]]On Behalf > > > > Of Patrick > > > Burrows > > > > Sent: 31 May 2002 14:22 > > > > To: [EMAIL PROTECTED] > > > > Subject: [DOTNET] COM Interop calling a C# DLL from VB6 > > > > > > > > > > > > Ok... I guess I'm not understanding what a strong name > is (in .NET > > > > terms). Why do I need a snk file? All I want to do is call > > > my C# DLL > > > > from VB6. > > > > > > > > I use sn.exe to create an SNK file. And I set > AssemblyKeyFile and > > > > AssemblyKeyName properties. But it is still saying my > > > Assembly doesn't > > > > > > > have a strong name. > > > > > > > > And I *truly* don't understand what any of this has to > do with COM > > > > interop. What does some sort of public key encryption have > > > to do with > > > > COM? > > > > > > > > > > > > Patrick Burrows > > > > What's he building in there? > > > > -------------------- > > > > Now Playing: unknown artist - frank sinatra - 05 - the way > > > y (patcast) > > > > -------------------- > > > > > > > > You can read messages from the DOTNET archive, unsubscribe from > > > > DOTNET, or subscribe to other DevelopMentor lists at > > > > http://discuss.develop.com. > > > > > > You can read messages from the DOTNET archive, unsubscribe from > > > DOTNET, or subscribe to other DevelopMentor lists at > > > http://discuss.develop.com. > > > > > > You can read messages from the > > > DOTNET archive, unsubscribe from DOTNET, or > > > subscribe to other DevelopMentor lists at > http://discuss.develop.com. > > > > > > >You can read messages from > the DOTNET archive, unsubscribe from DOTNET, or > >subscribe to other DevelopMentor lists at http://discuss.develop.com. > > > > > --------------------- > Sam Gentile > .NET Consultant > Co-author: Wrox Visual C++ .NET: A primer for C++ developers > BLOG: http://radio.weblogs.com/0105852/ > http://www.project-inspiration.com/sgentile/DotNet.htm > http://www.project-inspiration.com/sgentile/ > --------------------------- > > > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at > http://explorer.msn.com/intl.asp. > > You can read messages from > the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.