Multiple referenced dlls

G

Guest

We have a VB dll that invokes a C# dll. The C# dll references 3 other dlls -
one is a .NET dll, the other two are win32 COM dlls. I have a script that
invokes the VB dll which in turn successfully invokes the C# dll on my
development machine.

Next, I tried deploying to a stage server, but couldn't get the same test to
work there. It seems the C# dll is not being invoked. I moved the C# dll
and it's referenced .net and Interop dlls. I registered all 4 dlls using:
regasm mymain.dll
regasm mydotnet.dll
regasm Interop.First.dll
regasm Interop.Second.dll

I tried signing all the dlls:
sn -k myMain.dll (repeat for others)

Then tried gacutil for each dll, but get an error saying they cannot be
added to the GAC because they are not strongly named, even after using sn.exe.

I'm new to .NET - can anyone recommend the proper steps. I must be missing
something between the environments (I am thinking Visual Studio does some
registration for me that isn't happening on the stage machine?).

Thanks,
Jan
 
N

Nicholas Paldino [.NET/C# MVP]

Jan,

You said you can't get it to work there. What is the error that you are
getting?
 
B

Bruce Wood

First of all, if you're new to .NET, I recommend that you _stay away_
from strong naming and the GAC for now. I've been working with .NET for
a year now, and strong naming and the GAC are still too complicated for
my little brain, although I'm reading up on .NET Framework Security
(and it's still too complicated).

If you're developing and deploying applications in-house, just stick
with private assemblies. The only catch is that all of the DLLs have to
be in the same directory with your application. However, I think that
that's a small price to pay for not having to deal with the intricacies
of the GAC.

Get rid of the files created by sn in your project directory, and make
sure that none of your DLLs are strong-named. Then build them all and
put them in the same directory. If you still can't get it to work, post
the error message here, and give more details about what assembly calls
what other assemblies, and which assemblies are .NET and which are not,
and which you wrote and compiled and which you didn't.
 
G

Guest

Well, that is the thing- I don't get an error- the C# dll is just not being
invoked. To test it, I had each dll return a simple string so I would know
which dlls had been invoked. On the stage box, I get the string back from
the vb dll, but not the C# dll. On my dev box, I get both strings back.

Any ideas?

Much obliged,
Jan

Nicholas Paldino said:
Jan,

You said you can't get it to work there. What is the error that you are
getting?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jan said:
We have a VB dll that invokes a C# dll. The C# dll references 3 other
dlls -
one is a .NET dll, the other two are win32 COM dlls. I have a script that
invokes the VB dll which in turn successfully invokes the C# dll on my
development machine.

Next, I tried deploying to a stage server, but couldn't get the same test
to
work there. It seems the C# dll is not being invoked. I moved the C# dll
and it's referenced .net and Interop dlls. I registered all 4 dlls using:
regasm mymain.dll
regasm mydotnet.dll
regasm Interop.First.dll
regasm Interop.Second.dll

I tried signing all the dlls:
sn -k myMain.dll (repeat for others)

Then tried gacutil for each dll, but get an error saying they cannot be
added to the GAC because they are not strongly named, even after using
sn.exe.

I'm new to .NET - can anyone recommend the proper steps. I must be
missing
something between the environments (I am thinking Visual Studio does some
registration for me that isn't happening on the stage machine?).

Thanks,
Jan
 
N

Nicholas Paldino [.NET/C# MVP]

Are you sure your code is not swallowing the exception? Code just
doesn't get ignored. Is this code in an event handler of some sort?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jan said:
Well, that is the thing- I don't get an error- the C# dll is just not
being
invoked. To test it, I had each dll return a simple string so I would
know
which dlls had been invoked. On the stage box, I get the string back from
the vb dll, but not the C# dll. On my dev box, I get both strings back.

Any ideas?

Much obliged,
Jan

Nicholas Paldino said:
Jan,

You said you can't get it to work there. What is the error that you
are
getting?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jan said:
We have a VB dll that invokes a C# dll. The C# dll references 3 other
dlls -
one is a .NET dll, the other two are win32 COM dlls. I have a script
that
invokes the VB dll which in turn successfully invokes the C# dll on my
development machine.

Next, I tried deploying to a stage server, but couldn't get the same
test
to
work there. It seems the C# dll is not being invoked. I moved the C#
dll
and it's referenced .net and Interop dlls. I registered all 4 dlls
using:
regasm mymain.dll
regasm mydotnet.dll
regasm Interop.First.dll
regasm Interop.Second.dll

I tried signing all the dlls:
sn -k myMain.dll (repeat for others)

Then tried gacutil for each dll, but get an error saying they cannot be
added to the GAC because they are not strongly named, even after using
sn.exe.

I'm new to .NET - can anyone recommend the proper steps. I must be
missing
something between the environments (I am thinking Visual Studio does
some
registration for me that isn't happening on the stage machine?).

Thanks,
Jan
 
G

Guest

Yeah, I thought of that too, so tried returning the exception message and
still nothing. Here is what the public method in the C# dll looks like:

public string ProcessMyMessage(string sMessage)
{
string sResult = string.Empty;
try
{
sResult = "AIC Appraisal successfully invoked. This is a test to see if
C# dll will work.";
}
catch (Exception e)
{
sResult = "Exception occurred in CSharp dll. Message is: " + e.Message;
}
return sResult;


Nicholas Paldino said:
Are you sure your code is not swallowing the exception? Code just
doesn't get ignored. Is this code in an event handler of some sort?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jan said:
Well, that is the thing- I don't get an error- the C# dll is just not
being
invoked. To test it, I had each dll return a simple string so I would
know
which dlls had been invoked. On the stage box, I get the string back from
the vb dll, but not the C# dll. On my dev box, I get both strings back.

Any ideas?

Much obliged,
Jan

Nicholas Paldino said:
Jan,

You said you can't get it to work there. What is the error that you
are
getting?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

We have a VB dll that invokes a C# dll. The C# dll references 3 other
dlls -
one is a .NET dll, the other two are win32 COM dlls. I have a script
that
invokes the VB dll which in turn successfully invokes the C# dll on my
development machine.

Next, I tried deploying to a stage server, but couldn't get the same
test
to
work there. It seems the C# dll is not being invoked. I moved the C#
dll
and it's referenced .net and Interop dlls. I registered all 4 dlls
using:
regasm mymain.dll
regasm mydotnet.dll
regasm Interop.First.dll
regasm Interop.Second.dll

I tried signing all the dlls:
sn -k myMain.dll (repeat for others)

Then tried gacutil for each dll, but get an error saying they cannot be
added to the GAC because they are not strongly named, even after using
sn.exe.

I'm new to .NET - can anyone recommend the proper steps. I must be
missing
something between the environments (I am thinking Visual Studio does
some
registration for me that isn't happening on the stage machine?).

Thanks,
Jan
 
G

Guest

Sorry about the formatting- sent it before I was done formatting before:

public string ProcessMyMessage(string sMessage)
{
string sResult = string.Empty;
try
{
sResult = "AIC Appraisal successfully invoked. This is a test to
see if C# dll will work.";
}
catch (Exception e)
{
sResult = "Exception occurred in CSharp dll. Message is: " +
e.Message;
}
return sResult;
}


Jan said:
Yeah, I thought of that too, so tried returning the exception message and
still nothing. Here is what the public method in the C# dll looks like:

public string ProcessMyMessage(string sMessage)
{
string sResult = string.Empty;
try
{
sResult = "AIC Appraisal successfully invoked. This is a test to see if
C# dll will work.";
}
catch (Exception e)
{
sResult = "Exception occurred in CSharp dll. Message is: " + e.Message;
}
return sResult;


Nicholas Paldino said:
Are you sure your code is not swallowing the exception? Code just
doesn't get ignored. Is this code in an event handler of some sort?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jan said:
Well, that is the thing- I don't get an error- the C# dll is just not
being
invoked. To test it, I had each dll return a simple string so I would
know
which dlls had been invoked. On the stage box, I get the string back from
the vb dll, but not the C# dll. On my dev box, I get both strings back.

Any ideas?

Much obliged,
Jan

:

Jan,

You said you can't get it to work there. What is the error that you
are
getting?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

We have a VB dll that invokes a C# dll. The C# dll references 3 other
dlls -
one is a .NET dll, the other two are win32 COM dlls. I have a script
that
invokes the VB dll which in turn successfully invokes the C# dll on my
development machine.

Next, I tried deploying to a stage server, but couldn't get the same
test
to
work there. It seems the C# dll is not being invoked. I moved the C#
dll
and it's referenced .net and Interop dlls. I registered all 4 dlls
using:
regasm mymain.dll
regasm mydotnet.dll
regasm Interop.First.dll
regasm Interop.Second.dll

I tried signing all the dlls:
sn -k myMain.dll (repeat for others)

Then tried gacutil for each dll, but get an error saying they cannot be
added to the GAC because they are not strongly named, even after using
sn.exe.

I'm new to .NET - can anyone recommend the proper steps. I must be
missing
something between the environments (I am thinking Visual Studio does
some
registration for me that isn't happening on the stage machine?).

Thanks,
Jan
 
N

Nicholas Paldino [.NET/C# MVP]

Jan,

That's not going to do anything. You need to put an exception handler
around the code that is calling this through COM interop. This is almost
NEVER going to throw, since it's an assignment of a string. Unless you have
an out of memory exception, it will never throw.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jan said:
Sorry about the formatting- sent it before I was done formatting before:

public string ProcessMyMessage(string sMessage)
{
string sResult = string.Empty;
try
{
sResult = "AIC Appraisal successfully invoked. This is a test to
see if C# dll will work.";
}
catch (Exception e)
{
sResult = "Exception occurred in CSharp dll. Message is: " +
e.Message;
}
return sResult;
}


Jan said:
Yeah, I thought of that too, so tried returning the exception message and
still nothing. Here is what the public method in the C# dll looks like:

public string ProcessMyMessage(string sMessage)
{
string sResult = string.Empty;
try
{
sResult = "AIC Appraisal successfully invoked. This is a test to see if
C# dll will work.";
}
catch (Exception e)
{
sResult = "Exception occurred in CSharp dll. Message is: " + e.Message;
}
return sResult;


Nicholas Paldino said:
Are you sure your code is not swallowing the exception? Code just
doesn't get ignored. Is this code in an event handler of some sort?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Well, that is the thing- I don't get an error- the C# dll is just not
being
invoked. To test it, I had each dll return a simple string so I
would
know
which dlls had been invoked. On the stage box, I get the string back
from
the vb dll, but not the C# dll. On my dev box, I get both strings
back.

Any ideas?

Much obliged,
Jan

:

Jan,

You said you can't get it to work there. What is the error that
you
are
getting?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

We have a VB dll that invokes a C# dll. The C# dll references 3
other
dlls -
one is a .NET dll, the other two are win32 COM dlls. I have a
script
that
invokes the VB dll which in turn successfully invokes the C# dll
on my
development machine.

Next, I tried deploying to a stage server, but couldn't get the
same
test
to
work there. It seems the C# dll is not being invoked. I moved
the C#
dll
and it's referenced .net and Interop dlls. I registered all 4
dlls
using:
regasm mymain.dll
regasm mydotnet.dll
regasm Interop.First.dll
regasm Interop.Second.dll

I tried signing all the dlls:
sn -k myMain.dll (repeat for others)

Then tried gacutil for each dll, but get an error saying they
cannot be
added to the GAC because they are not strongly named, even after
using
sn.exe.

I'm new to .NET - can anyone recommend the proper steps. I must
be
missing
something between the environments (I am thinking Visual Studio
does
some
registration for me that isn't happening on the stage machine?).

Thanks,
Jan
 
G

Guest

Thx.. the vb Com was swallowing the exception. Now I get the error: "File
or assembly name MyCSharpDLL, or one of its dependencies, was not found."

I've run regasm (with and without the tlb parameter) on it, what could be
missing?

Nicholas Paldino said:
Jan,

That's not going to do anything. You need to put an exception handler
around the code that is calling this through COM interop. This is almost
NEVER going to throw, since it's an assignment of a string. Unless you have
an out of memory exception, it will never throw.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jan said:
Sorry about the formatting- sent it before I was done formatting before:

public string ProcessMyMessage(string sMessage)
{
string sResult = string.Empty;
try
{
sResult = "AIC Appraisal successfully invoked. This is a test to
see if C# dll will work.";
}
catch (Exception e)
{
sResult = "Exception occurred in CSharp dll. Message is: " +
e.Message;
}
return sResult;
}


Jan said:
Yeah, I thought of that too, so tried returning the exception message and
still nothing. Here is what the public method in the C# dll looks like:

public string ProcessMyMessage(string sMessage)
{
string sResult = string.Empty;
try
{
sResult = "AIC Appraisal successfully invoked. This is a test to see if
C# dll will work.";
}
catch (Exception e)
{
sResult = "Exception occurred in CSharp dll. Message is: " + e.Message;
}
return sResult;


:

Are you sure your code is not swallowing the exception? Code just
doesn't get ignored. Is this code in an event handler of some sort?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Well, that is the thing- I don't get an error- the C# dll is just not
being
invoked. To test it, I had each dll return a simple string so I
would
know
which dlls had been invoked. On the stage box, I get the string back
from
the vb dll, but not the C# dll. On my dev box, I get both strings
back.

Any ideas?

Much obliged,
Jan

:

Jan,

You said you can't get it to work there. What is the error that
you
are
getting?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

We have a VB dll that invokes a C# dll. The C# dll references 3
other
dlls -
one is a .NET dll, the other two are win32 COM dlls. I have a
script
that
invokes the VB dll which in turn successfully invokes the C# dll
on my
development machine.

Next, I tried deploying to a stage server, but couldn't get the
same
test
to
work there. It seems the C# dll is not being invoked. I moved
the C#
dll
and it's referenced .net and Interop dlls. I registered all 4
dlls
using:
regasm mymain.dll
regasm mydotnet.dll
regasm Interop.First.dll
regasm Interop.Second.dll

I tried signing all the dlls:
sn -k myMain.dll (repeat for others)

Then tried gacutil for each dll, but get an error saying they
cannot be
added to the GAC because they are not strongly named, even after
using
sn.exe.

I'm new to .NET - can anyone recommend the proper steps. I must
be
missing
something between the environments (I am thinking Visual Studio
does
some
registration for me that isn't happening on the stage machine?).

Thanks,
Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top