T
Tony
I've seen several messages and read through them and MANY websites and
various MSDN items and still don't have a solution.
I made a dll in C# from the code below for testing
using System;
using System.Runtime.InteropServices; // necessary library to use COM
attributes
namespace mcMath
{
/// <summary>
/// Summary description for Class1.
/// </summary>
///
[ComVisible(true)]
[ProgId("mcMath.mcMath")]
[Guid("2A77EA02-8617-43a7-B5D9-1FE09153AC07")]
[ClassInterface(ClassInterfaceType.None)]
public class mcMathComp
{
private bool bTest = false;
public mcMathComp()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// //This is a test method
/// </summary>
public void mcTestMethod()
{
}
public long Add(long val1, long val2)
{
return val1 + val2;
}
/// <summary>
/// //This is a test property
/// </summary>
public bool Extra
{
get
{
return bTest;
}
set
{
bTest = value;
}
}
}
}
From the various sites and info I've read, I added the interop using
lline and also the three lines
[ComVisible(true)]
[ProgId("mcMath.mcMath")]
[Guid("2A77EA02-8617-43a7-B5D9-1FE09153AC07")]
[ClassInterface(ClassInterfaceType.None)]
The guid string I got from having the code for the dll open and going
to Tools > Create UID and chose Registry Format
I then dropped to command line and ran
C:\Documents and Settings\Tony\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\REGASM.exe
mcmath.dll /tlb:mcmath.pdb
After all that, I could finally see it to add it as a reference to a
vb6 app, but when I do, the actual methods aren't available.. only
thing I have are things like tostring and gethash ..
I did some more reading and found some info to do the below
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>gacutil.exe /i
"C:\Documents and Settings\Tony\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug\mcmath.dll"
Microsoft (R) .NET Global Assembly Cache Utility. Version2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Failure adding assembly to the cache: Attempt to install an assembly
without a strong name
----
Did some more reading and then did the below
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>sn -k
"C:\Documents andSettings\Tony\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug\mcmath.dll"
Microsoft (R) .NET Framework Strong Name Utility Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Key pair written to C:\Documents and Settings\Tonyk\My
Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug\mcmath.dll
----
Great, I thought... Now I can do the gacutil again and be home free.
wrong...
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>gacutil.exe /i
"C:\Docum
ents and Settings\Tonyk\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\b
in\Debug\mcmath.dll"
Microsoft (R) .NET Global Assembly Cache Utility. Version
2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Failure adding assembly to the cache: The module was expected to
contain an assembly manifest.
---
After every task leading to another task in my effort to get a C# .dll
to run under VB6, I'm begining to think maybe I'm following the wrong
trail of bread crumbs and this should be a lot simplier than I'm
finding?
In the end, I'm looking to use a .Net component in C# and pop the code
into a .dll that a vb6 app can use
Help?
-Tony!-
various MSDN items and still don't have a solution.
I made a dll in C# from the code below for testing
using System;
using System.Runtime.InteropServices; // necessary library to use COM
attributes
namespace mcMath
{
/// <summary>
/// Summary description for Class1.
/// </summary>
///
[ComVisible(true)]
[ProgId("mcMath.mcMath")]
[Guid("2A77EA02-8617-43a7-B5D9-1FE09153AC07")]
[ClassInterface(ClassInterfaceType.None)]
public class mcMathComp
{
private bool bTest = false;
public mcMathComp()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// //This is a test method
/// </summary>
public void mcTestMethod()
{
}
public long Add(long val1, long val2)
{
return val1 + val2;
}
/// <summary>
/// //This is a test property
/// </summary>
public bool Extra
{
get
{
return bTest;
}
set
{
bTest = value;
}
}
}
}
From the various sites and info I've read, I added the interop using
lline and also the three lines
[ComVisible(true)]
[ProgId("mcMath.mcMath")]
[Guid("2A77EA02-8617-43a7-B5D9-1FE09153AC07")]
[ClassInterface(ClassInterfaceType.None)]
The guid string I got from having the code for the dll open and going
to Tools > Create UID and chose Registry Format
I then dropped to command line and ran
C:\Documents and Settings\Tony\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\REGASM.exe
mcmath.dll /tlb:mcmath.pdb
After all that, I could finally see it to add it as a reference to a
vb6 app, but when I do, the actual methods aren't available.. only
thing I have are things like tostring and gethash ..
I did some more reading and found some info to do the below
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>gacutil.exe /i
"C:\Documents and Settings\Tony\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug\mcmath.dll"
Microsoft (R) .NET Global Assembly Cache Utility. Version2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Failure adding assembly to the cache: Attempt to install an assembly
without a strong name
----
Did some more reading and then did the below
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>sn -k
"C:\Documents andSettings\Tony\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug\mcmath.dll"
Microsoft (R) .NET Framework Strong Name Utility Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Key pair written to C:\Documents and Settings\Tonyk\My
Documents\Visual Studio
2005\Projects\mcmath\mcmath\bin\Debug\mcmath.dll
----
Great, I thought... Now I can do the gacutil again and be home free.
wrong...
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>gacutil.exe /i
"C:\Docum
ents and Settings\Tonyk\My Documents\Visual Studio
2005\Projects\mcmath\mcmath\b
in\Debug\mcmath.dll"
Microsoft (R) .NET Global Assembly Cache Utility. Version
2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Failure adding assembly to the cache: The module was expected to
contain an assembly manifest.
---
After every task leading to another task in my effort to get a C# .dll
to run under VB6, I'm begining to think maybe I'm following the wrong
trail of bread crumbs and this should be a lot simplier than I'm
finding?
In the end, I'm looking to use a .Net component in C# and pop the code
into a .dll that a vb6 app can use
Help?
-Tony!-