468,765 Members | 1,212 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Non-strong named interop libraries Part 2

Hey all,

I'm really going through a small hell right now - I've completely lost it :)

I made a project, using two interop libraries from exchange (created them as
in this msdn article:
http://msdn.microsoft.com/library/de...gmngsinks.asp). I
set my project properties as 'Register as COM interop' to true, I can
install it my project on my developement machine without a flaw. Great.

Now I wanted to install it on another machine with a .NET framework. I set
the 'Register as COM interop' to false, recompiled, and copied the files to
the other machine. I used the regsvcs.exe tool for it to register it, as
pointed out to me by Nicholas Paldino in another question of mine. Now I get
the error that my dll does not have a strong name.

So back to my developement machine. When I use the sn.exe tool to create a
strong key, I put this info in the project properties and the
assemblyinfo.cs file, and I recompile, I get another error: one (not both!)
of the interop dll files from exchange does not have a strong name. If I
look at the properties of these interop files, I can clearly see that one of
them has the 'Strong name' property set to 'true' and one to 'false'. Why
they both do not have a strong name is a mystery to me since I followed the
steps in the MSDN article as mentioned before, and you'd expect they'd
conveniently both have strong names, but alas.

So, in another post of Patty O'dors in this newsgroup I read a solution to
this... but doesn't work. If I set the key file in the VS.NET project
properties, this doesn't work. If I use the tlbimp.exe tool on the
oldInterop file (without the strong name) using:

tlbimp.exe oldInterop.dll /keyfile: someKeyFile.snk /out:newInterop.dll

I get the error: oldInterop.dll is not a valid type library

AAArrrgh I mean... why is that? I can add it as a reference, browse through
it and all, and now jet ANOTHER error. It really frustrates me. I only want
to deploy my fine working project on another machine, and I have to go
through all this :) Anyway, can anyone please help me with this?

Thanks a million,

Razzie
Nov 16 '05 #1
20 2902
Well what I did before was indeed the weak dll.
However, if I try now to use tlbimp on my project DLL file, I still get the
'is not a valid type library' error :(

"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
From the way I read Nicholas' reply to me, you don't use tlbimp.exe on the
(weak) interop DLL to 'convert' it, you use it on the *ACTUAL COM DLL*.
So, say if I wanted to create a strong named interop library to replace
the
weak-named SQLDMO.Interop.dll that is generated automatically

I would type
tlbimp "c:\program files\microsoft sql server\80\tools\binn\sqldmo.dll"
/keyfile:sqldmokey.snk /out:SQLDMO.StrongInterop.dll

NOT

tlbimp "sqldmo.interop.dll" /keyfile:sqldmokey.snk
/out:SQLDMO.StrongInterop.dll

is this what you're doing?

Nov 16 '05 #2
Razzie,

Patty was right, in that you should not use TLBIMP on the interop
assembly itself. It seems now you are trying to use it on the output of
your project? You need to run TLBIMP on the COM dll/tlb that has the types
you want to import from COM, and then add a reference to the DLL that is
produced by TLBIMP.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Razzie" <ra****@quicknet.nl> wrote in message
news:e6*************@TK2MSFTNGP12.phx.gbl...
Well what I did before was indeed the weak dll.
However, if I try now to use tlbimp on my project DLL file, I still get
the 'is not a valid type library' error :(

"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
From the way I read Nicholas' reply to me, you don't use tlbimp.exe on
the
(weak) interop DLL to 'convert' it, you use it on the *ACTUAL COM DLL*.
So, say if I wanted to create a strong named interop library to replace
the
weak-named SQLDMO.Interop.dll that is generated automatically

I would type
tlbimp "c:\program files\microsoft sql server\80\tools\binn\sqldmo.dll"
/keyfile:sqldmokey.snk /out:SQLDMO.StrongInterop.dll

NOT

tlbimp "sqldmo.interop.dll" /keyfile:sqldmokey.snk
/out:SQLDMO.StrongInterop.dll

is this what you're doing?


Nov 16 '05 #3
Hi Nicholas,

That is... not possible. Would you please take a look at this?
http://msdn.microsoft.com/library/de...ngmngsinks.asp
If you scroll just a little bit down, you will see 'To build the interop'.
This produces number one of my interops... that is the strong one.
In the step that follows, 'To build the wrappers', the
Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.

I can't use tlbimp on that one. Yet the MSDN article tells me to build it
using that example. But it ain't strong, and since I have little knowledge
what tlbimp etc really does, I don't know if this can be fixed?

Razzie

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eK*************@TK2MSFTNGP15.phx.gbl...
Razzie,

Patty was right, in that you should not use TLBIMP on the interop
assembly itself. It seems now you are trying to use it on the output of
your project? You need to run TLBIMP on the COM dll/tlb that has the
types you want to import from COM, and then add a reference to the DLL
that is produced by TLBIMP.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Razzie" <ra****@quicknet.nl> wrote in message
news:e6*************@TK2MSFTNGP12.phx.gbl...
Well what I did before was indeed the weak dll.
However, if I try now to use tlbimp on my project DLL file, I still get
the 'is not a valid type library' error :(

"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
From the way I read Nicholas' reply to me, you don't use tlbimp.exe on
the
(weak) interop DLL to 'convert' it, you use it on the *ACTUAL COM DLL*.
So, say if I wanted to create a strong named interop library to replace
the
weak-named SQLDMO.Interop.dll that is generated automatically

I would type
tlbimp "c:\program files\microsoft sql server\80\tools\binn\sqldmo.dll"
/keyfile:sqldmokey.snk /out:SQLDMO.StrongInterop.dll

NOT

tlbimp "sqldmo.interop.dll" /keyfile:sqldmokey.snk
/out:SQLDMO.StrongInterop.dll

is this what you're doing?



Nov 16 '05 #4

"Razzie" <ra****@quicknet.nl> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi Nicholas,

That is... not possible. Would you please take a look at this?
http://msdn.microsoft.com/library/de...ngmngsinks.asp
If you scroll just a little bit down, you will see 'To build the interop'.
This produces number one of my interops... that is the strong one.
In the step that follows, 'To build the wrappers', the
Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.

I can't use tlbimp on that one. Yet the MSDN article tells me to build it
using that example. But it ain't strong, and since I have little knowledge
what tlbimp etc really does, I don't know if this can be fixed?

Razzie


Hmm... there is only one interop assembly -
Microsoft.Exchange.Transport.EventInterop.dll.
The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your wrapper
dll a normal .NET assembly exposing COM interfaces, this one should
(optionally) be strong named, and registered using regasm.exe with /tlb and
/codebase options. The /tlb option forces the typelib to be created (see
xxx.tlb after execution of regasm) and registered, the /codebase option is
used if you don't want your assembly to be stored in the GAC. If you need to
install the assembly in the GAC run gacutil.exe (note: only available when
the .NET sdk is installed on the machine).
So in your case just run:

regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
note - that when running this on a non strong named assembly you should get
a warning, but in general this can be safely ignored.
- don't use regsvcs.exe, this tool is meant to register and install
COM+ ( Enterprise Services derived ) class objects.
- Make ABSOLUTELY sure the COM dll from which you created the
interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is also
installed and registered.
Willy.


Nov 16 '05 #5
Thanks for this reply! I will test this first thing tomorrow morning, I'm
sure I'll have another question about it, because since I have to make my
project output dll strong (to deploy on other machine), but won't compile
that way because of EventWrappers.dll not being strong - will using
regasm.exe fix that? Oh well, trying that tomorrow. At least thanks so far
:)

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...

"Razzie" <ra****@quicknet.nl> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi Nicholas,

That is... not possible. Would you please take a look at this?
http://msdn.microsoft.com/library/de...ngmngsinks.asp
If you scroll just a little bit down, you will see 'To build the
interop'. This produces number one of my interops... that is the strong
one.
In the step that follows, 'To build the wrappers', the
Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.

I can't use tlbimp on that one. Yet the MSDN article tells me to build it
using that example. But it ain't strong, and since I have little
knowledge what tlbimp etc really does, I don't know if this can be fixed?

Razzie


Hmm... there is only one interop assembly -
Microsoft.Exchange.Transport.EventInterop.dll.
The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your
wrapper dll a normal .NET assembly exposing COM interfaces, this one
should (optionally) be strong named, and registered using regasm.exe with
/tlb and /codebase options. The /tlb option forces the typelib to be
created (see xxx.tlb after execution of regasm) and registered, the
/codebase option is used if you don't want your assembly to be stored in
the GAC. If you need to install the assembly in the GAC run gacutil.exe
(note: only available when the .NET sdk is installed on the machine).
So in your case just run:

regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
note - that when running this on a non strong named assembly you should
get a warning, but in general this can be safely ignored.
- don't use regsvcs.exe, this tool is meant to register and install
COM+ ( Enterprise Services derived ) class objects.
- Make ABSOLUTELY sure the COM dll from which you created the
interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is also
installed and registered.
Willy.

Nov 16 '05 #6
Willy,

I tested this and sorry to say but it does not work.

I get the error 'assembly (EventWrappers) is not a strong name' when
compiling my porject, after forcing my output dll to be strong in VS.NET.
This was necessary or else I'd get the same error when trying to register my
output COM DLL on the other machine using regsvcs.exe (I take it I still
need to do that in order to deploy my project on the other machine).

Any other ideas? :)

Razzie

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...

"Razzie" <ra****@quicknet.nl> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi Nicholas,

That is... not possible. Would you please take a look at this?
http://msdn.microsoft.com/library/de...ngmngsinks.asp
If you scroll just a little bit down, you will see 'To build the
interop'. This produces number one of my interops... that is the strong
one.
In the step that follows, 'To build the wrappers', the
Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.

I can't use tlbimp on that one. Yet the MSDN article tells me to build it
using that example. But it ain't strong, and since I have little
knowledge what tlbimp etc really does, I don't know if this can be fixed?

Razzie


Hmm... there is only one interop assembly -
Microsoft.Exchange.Transport.EventInterop.dll.
The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your
wrapper dll a normal .NET assembly exposing COM interfaces, this one
should (optionally) be strong named, and registered using regasm.exe with
/tlb and /codebase options. The /tlb option forces the typelib to be
created (see xxx.tlb after execution of regasm) and registered, the
/codebase option is used if you don't want your assembly to be stored in
the GAC. If you need to install the assembly in the GAC run gacutil.exe
(note: only available when the .NET sdk is installed on the machine).
So in your case just run:

regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
note - that when running this on a non strong named assembly you should
get a warning, but in general this can be safely ignored.
- don't use regsvcs.exe, this tool is meant to register and install
COM+ ( Enterprise Services derived ) class objects.
- Make ABSOLUTELY sure the COM dll from which you created the
interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is also
installed and registered.
Willy.

Nov 16 '05 #7
OK. Take a step back from it for a minute, and describe your Solution.

* The final output / aim of the solution, e.g. windows forms program called
*****.exe, web application, .NET DLL to be installed as development tool, etc.
* What projects it contains, their names, types and which depend on each other
* The already-built / binary dependencies of each project, their type (e.g.
COM DLL, .NET DLL), and what their functionality is / reason they're used.
* What you've been doing that you expect to work but doesn't, and why you
expect it to work.

But please write a list / bullets, not prose.


"Razzie" wrote:
Willy,

I tested this and sorry to say but it does not work.

I get the error 'assembly (EventWrappers) is not a strong name' when
compiling my porject, after forcing my output dll to be strong in VS.NET.
This was necessary or else I'd get the same error when trying to register my
output COM DLL on the other machine using regsvcs.exe (I take it I still
need to do that in order to deploy my project on the other machine).

Any other ideas? :)

Razzie

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...

"Razzie" <ra****@quicknet.nl> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi Nicholas,

That is... not possible. Would you please take a look at this?
http://msdn.microsoft.com/library/de...ngmngsinks.asp
If you scroll just a little bit down, you will see 'To build the
interop'. This produces number one of my interops... that is the strong
one.
In the step that follows, 'To build the wrappers', the
Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.

I can't use tlbimp on that one. Yet the MSDN article tells me to build it
using that example. But it ain't strong, and since I have little
knowledge what tlbimp etc really does, I don't know if this can be fixed?

Razzie


Hmm... there is only one interop assembly -
Microsoft.Exchange.Transport.EventInterop.dll.
The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your
wrapper dll a normal .NET assembly exposing COM interfaces, this one
should (optionally) be strong named, and registered using regasm.exe with
/tlb and /codebase options. The /tlb option forces the typelib to be
created (see xxx.tlb after execution of regasm) and registered, the
/codebase option is used if you don't want your assembly to be stored in
the GAC. If you need to install the assembly in the GAC run gacutil.exe
(note: only available when the .NET sdk is installed on the machine).
So in your case just run:

regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
note - that when running this on a non strong named assembly you should
get a warning, but in general this can be safely ignored.
- don't use regsvcs.exe, this tool is meant to register and install
COM+ ( Enterprise Services derived ) class objects.
- Make ABSOLUTELY sure the COM dll from which you created the
interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is also
installed and registered.
Willy.


Nov 16 '05 #8
Hehe might be a good idea :) Here goes, from the beginning:

I'm developing a COM+ dll that serves as an Exchange Event Sink (although
that is not relevant to my problem). I've followed this MSDN article to get
me started:
http://msdn.microsoft.com/library/de...ngmngsinks.asp

If you scroll down just a little bit in that tutorial, you can see 'To build
the interop'. This creates a EventInterop.dll from a C++ idl file or
something (I don't know that much about it). The next step, 'To build the
wrappers', creates an EventWrappers.dll file from the EventInterop.dll file,
using that little script as shown below in the MSDN.

I add these to my project, I set the 'Register for COM Interop' in my
project properties to 'true' and I can build my project, can install it as
an Exchange Sink, and it works flawlessly.

Now comes the problem. I need to get this project to a machine other than my
developement machine. This other machine has the .NET framework SDK
installed.
- First, I set the 'Register for COM Interop' to false.
- I copied all the output files to the target machine.
- When I try to register my output dll *on the target machine using
regsvcs.exe*, I get the error 'the assembly (my project output dll) does not
have a strong name'.
- I went back to my developement machine, and forced my output dll to have a
strong name, creating a key with sn.exe, adding it in the project properties
and assemblyinfo.cs. But now *on compiling*, I get the error
'EventWrappers.dll' does not have a strong name.
- When I take a look at the properties of each of the two dll files created
as in the MSDN article, I can clearly see that EventInterop.dll has the
'strong name' property value set to 'true', while the EventWrappers.dll has
it set to 'false'. So I was thinking of giving the EventWrappers.dll a
strong name.
- I used tlbimp.exe to give the EventWrappers.dll a strong name. However, it
gives the error 'EventWrappers.dll is not a valid type library'.
- I tried using tlbimp.exe on the EventInterop.dll and create an output
EventWrappers.dll, but I get the same error.
- I can't use tlbimp.exe on the 'default' EventWrappers.dll because that one
doesn't even exist (since it is created in the way as described in the MSDN
article).

So concluded: I need my output dll to be strong, but as soon as I force it
to have strong name, it won't compile because of EventWrappers.dll not being
strong, and I can't force that one to be strong.

So my obvious question is: how do I fix this? Can you change something in
the MSDN article EventWrappers.dll creation to give it a strong name right
away? Any other .NET tools that can fix this? Since I've been stuck for too
long and have no idea how to continue, help is much, much appreciated :)

Thanks in advance,

Razzie
"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.com...
OK. Take a step back from it for a minute, and describe your Solution.

* The final output / aim of the solution, e.g. windows forms program
called
*****.exe, web application, .NET DLL to be installed as development tool,
etc.
* What projects it contains, their names, types and which depend on each
other
* The already-built / binary dependencies of each project, their type
(e.g.
COM DLL, .NET DLL), and what their functionality is / reason they're used.
* What you've been doing that you expect to work but doesn't, and why you
expect it to work.

But please write a list / bullets, not prose.


"Razzie" wrote:
Willy,

I tested this and sorry to say but it does not work.

I get the error 'assembly (EventWrappers) is not a strong name' when
compiling my porject, after forcing my output dll to be strong in VS.NET.
This was necessary or else I'd get the same error when trying to register
my
output COM DLL on the other machine using regsvcs.exe (I take it I still
need to do that in order to deploy my project on the other machine).

Any other ideas? :)

Razzie

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
>
> "Razzie" <ra****@quicknet.nl> wrote in message
> news:ed**************@TK2MSFTNGP12.phx.gbl...
>> Hi Nicholas,
>>
>> That is... not possible. Would you please take a look at this?
>> http://msdn.microsoft.com/library/de...ngmngsinks.asp
>> If you scroll just a little bit down, you will see 'To build the
>> interop'. This produces number one of my interops... that is the
>> strong
>> one.
>> In the step that follows, 'To build the wrappers', the
>> Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.
>>
>> I can't use tlbimp on that one. Yet the MSDN article tells me to build
>> it
>> using that example. But it ain't strong, and since I have little
>> knowledge what tlbimp etc really does, I don't know if this can be
>> fixed?
>>
>> Razzie
>
> Hmm... there is only one interop assembly -
> Microsoft.Exchange.Transport.EventInterop.dll.
> The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your
> wrapper dll a normal .NET assembly exposing COM interfaces, this one
> should (optionally) be strong named, and registered using regasm.exe
> with
> /tlb and /codebase options. The /tlb option forces the typelib to be
> created (see xxx.tlb after execution of regasm) and registered, the
> /codebase option is used if you don't want your assembly to be stored
> in
> the GAC. If you need to install the assembly in the GAC run gacutil.exe
> (note: only available when the .NET sdk is installed on the machine).
> So in your case just run:
>
> regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
> note - that when running this on a non strong named assembly you should
> get a warning, but in general this can be safely ignored.
> - don't use regsvcs.exe, this tool is meant to register and
> install
> COM+ ( Enterprise Services derived ) class objects.
> - Make ABSOLUTELY sure the COM dll from which you created the
> interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is
> also
> installed and registered.
> Willy.
>
>
>
>


Nov 16 '05 #9
As I told you before you should NOT register using regsvcs.exe, this tools
is meant to register EnterpriseServices derived classes in the COM catalog.
Your wrapper is not derived from System.EnterpriseServices and should not
derive from it.

Willy.

"Razzie" <ra****@quicknet.nl> wrote in message
news:Op**************@TK2MSFTNGP14.phx.gbl...
Willy,

I tested this and sorry to say but it does not work.

I get the error 'assembly (EventWrappers) is not a strong name' when
compiling my porject, after forcing my output dll to be strong in VS.NET.
This was necessary or else I'd get the same error when trying to register
my output COM DLL on the other machine using regsvcs.exe (I take it I
still need to do that in order to deploy my project on the other machine).

Any other ideas? :)

Razzie

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...

"Razzie" <ra****@quicknet.nl> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi Nicholas,

That is... not possible. Would you please take a look at this?
http://msdn.microsoft.com/library/de...ngmngsinks.asp
If you scroll just a little bit down, you will see 'To build the
interop'. This produces number one of my interops... that is the strong
one.
In the step that follows, 'To build the wrappers', the
Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.

I can't use tlbimp on that one. Yet the MSDN article tells me to build
it using that example. But it ain't strong, and since I have little
knowledge what tlbimp etc really does, I don't know if this can be
fixed?

Razzie


Hmm... there is only one interop assembly -
Microsoft.Exchange.Transport.EventInterop.dll.
The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your
wrapper dll a normal .NET assembly exposing COM interfaces, this one
should (optionally) be strong named, and registered using regasm.exe with
/tlb and /codebase options. The /tlb option forces the typelib to be
created (see xxx.tlb after execution of regasm) and registered, the
/codebase option is used if you don't want your assembly to be stored in
the GAC. If you need to install the assembly in the GAC run gacutil.exe
(note: only available when the .NET sdk is installed on the machine).
So in your case just run:

regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
note - that when running this on a non strong named assembly you should
get a warning, but in general this can be safely ignored.
- don't use regsvcs.exe, this tool is meant to register and
install COM+ ( Enterprise Services derived ) class objects.
- Make ABSOLUTELY sure the COM dll from which you created the
interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is also
installed and registered.
Willy.


Nov 16 '05 #10
Razzie,

Your fundamental mistake is to think you are developing a COM+ dll which is
not the case, it's just a .NET class exposed as COM class. As such you
should NOT use regsvcs.exe which is meant to register COM+ classes in the
catalog.
You need to register your COM assembly using regasm.exe like I explained in
another post.
If you want your assembly (your so called wrapper) to be strong named (else
regasm.exe will give you a warning), you need to have both the referenced
assemblies Interop.dll and Wrapper.dll to be strong named too. But again
this is NOT an absolut requirement, regasm.exe will register your assembly
correctly.

Another mistake is that you are trying to use tlbimp.exe on a .NET assembly,
tlbimp takes a NATIVE COM dll or typelib (xxx.tlb) as input, that is a COM
dll built using C++ or VB6 (and VB4-VB5) .

Willy.

"Razzie" <ra****@quicknet.nl> wrote in message
news:uu**************@TK2MSFTNGP11.phx.gbl...
Hehe might be a good idea :) Here goes, from the beginning:

I'm developing a COM+ dll that serves as an Exchange Event Sink (although
that is not relevant to my problem). I've followed this MSDN article to
get me started:
http://msdn.microsoft.com/library/de...ngmngsinks.asp

If you scroll down just a little bit in that tutorial, you can see 'To
build the interop'. This creates a EventInterop.dll from a C++ idl file or
something (I don't know that much about it). The next step, 'To build the
wrappers', creates an EventWrappers.dll file from the EventInterop.dll
file, using that little script as shown below in the MSDN.

I add these to my project, I set the 'Register for COM Interop' in my
project properties to 'true' and I can build my project, can install it as
an Exchange Sink, and it works flawlessly.

Now comes the problem. I need to get this project to a machine other than
my developement machine. This other machine has the .NET framework SDK
installed.
- First, I set the 'Register for COM Interop' to false.
- I copied all the output files to the target machine.
- When I try to register my output dll *on the target machine using
regsvcs.exe*, I get the error 'the assembly (my project output dll) does
not have a strong name'.
- I went back to my developement machine, and forced my output dll to have
a strong name, creating a key with sn.exe, adding it in the project
properties and assemblyinfo.cs. But now *on compiling*, I get the error
'EventWrappers.dll' does not have a strong name.
- When I take a look at the properties of each of the two dll files
created as in the MSDN article, I can clearly see that EventInterop.dll
has the 'strong name' property value set to 'true', while the
EventWrappers.dll has it set to 'false'. So I was thinking of giving the
EventWrappers.dll a strong name.
- I used tlbimp.exe to give the EventWrappers.dll a strong name. However,
it gives the error 'EventWrappers.dll is not a valid type library'.
- I tried using tlbimp.exe on the EventInterop.dll and create an output
EventWrappers.dll, but I get the same error.
- I can't use tlbimp.exe on the 'default' EventWrappers.dll because that
one doesn't even exist (since it is created in the way as described in the
MSDN article).

So concluded: I need my output dll to be strong, but as soon as I force it
to have strong name, it won't compile because of EventWrappers.dll not
being strong, and I can't force that one to be strong.

So my obvious question is: how do I fix this? Can you change something in
the MSDN article EventWrappers.dll creation to give it a strong name right
away? Any other .NET tools that can fix this? Since I've been stuck for
too long and have no idea how to continue, help is much, much appreciated
:)

Thanks in advance,

Razzie
"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.com...
OK. Take a step back from it for a minute, and describe your Solution.

* The final output / aim of the solution, e.g. windows forms program
called
*****.exe, web application, .NET DLL to be installed as development tool,
etc.
* What projects it contains, their names, types and which depend on each
other
* The already-built / binary dependencies of each project, their type
(e.g.
COM DLL, .NET DLL), and what their functionality is / reason they're
used.
* What you've been doing that you expect to work but doesn't, and why you
expect it to work.

But please write a list / bullets, not prose.


"Razzie" wrote:
Willy,

I tested this and sorry to say but it does not work.

I get the error 'assembly (EventWrappers) is not a strong name' when
compiling my porject, after forcing my output dll to be strong in
VS.NET.
This was necessary or else I'd get the same error when trying to
register my
output COM DLL on the other machine using regsvcs.exe (I take it I still
need to do that in order to deploy my project on the other machine).

Any other ideas? :)

Razzie

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
>
> "Razzie" <ra****@quicknet.nl> wrote in message
> news:ed**************@TK2MSFTNGP12.phx.gbl...
>> Hi Nicholas,
>>
>> That is... not possible. Would you please take a look at this?
>> http://msdn.microsoft.com/library/de...ngmngsinks.asp
>> If you scroll just a little bit down, you will see 'To build the
>> interop'. This produces number one of my interops... that is the
>> strong
>> one.
>> In the step that follows, 'To build the wrappers', the
>> Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.
>>
>> I can't use tlbimp on that one. Yet the MSDN article tells me to
>> build it
>> using that example. But it ain't strong, and since I have little
>> knowledge what tlbimp etc really does, I don't know if this can be
>> fixed?
>>
>> Razzie
>
> Hmm... there is only one interop assembly -
> Microsoft.Exchange.Transport.EventInterop.dll.
> The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your
> wrapper dll a normal .NET assembly exposing COM interfaces, this one
> should (optionally) be strong named, and registered using regasm.exe
> with
> /tlb and /codebase options. The /tlb option forces the typelib to be
> created (see xxx.tlb after execution of regasm) and registered, the
> /codebase option is used if you don't want your assembly to be stored
> in
> the GAC. If you need to install the assembly in the GAC run
> gacutil.exe
> (note: only available when the .NET sdk is installed on the machine).
> So in your case just run:
>
> regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
> note - that when running this on a non strong named assembly you
> should
> get a warning, but in general this can be safely ignored.
> - don't use regsvcs.exe, this tool is meant to register and
> install
> COM+ ( Enterprise Services derived ) class objects.
> - Make ABSOLUTELY sure the COM dll from which you created the
> interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is
> also
> installed and registered.
> Willy.
>
>
>
>


Nov 16 '05 #11
Willy,

First of all thank you for your determination to help me, I really
appreciate it.

I did what you told me to, and although everything completed without an
error, I think I still miss a final thing.
If I install the dll on the other machine, nothing seems to be happening. On
my developement machine, after compiling and binding it to my smpt server, I
can see that it works when I communicate with my SMTP server, and a log file
is created, etc.
On the target machine, I use the regasm too, it completes succesfully, bind
it to the smtp server, which also says that everything is ok, but nothing
happens after that. The SMTP server there behaves as before, no log file
created, etc.

So, can I somewhere see that the dll is 'running' somewhere, either in
registry, or in Com Applications, etc? Or do I miss a final step?

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:e8*************@TK2MSFTNGP12.phx.gbl...
Razzie,

Your fundamental mistake is to think you are developing a COM+ dll which
is not the case, it's just a .NET class exposed as COM class. As such you
should NOT use regsvcs.exe which is meant to register COM+ classes in the
catalog.
You need to register your COM assembly using regasm.exe like I explained
in another post.
If you want your assembly (your so called wrapper) to be strong named
(else regasm.exe will give you a warning), you need to have both the
referenced assemblies Interop.dll and Wrapper.dll to be strong named too.
But again this is NOT an absolut requirement, regasm.exe will register
your assembly correctly.

Another mistake is that you are trying to use tlbimp.exe on a .NET
assembly, tlbimp takes a NATIVE COM dll or typelib (xxx.tlb) as input,
that is a COM dll built using C++ or VB6 (and VB4-VB5) .

Willy.

"Razzie" <ra****@quicknet.nl> wrote in message
news:uu**************@TK2MSFTNGP11.phx.gbl...
Hehe might be a good idea :) Here goes, from the beginning:

I'm developing a COM+ dll that serves as an Exchange Event Sink (although
that is not relevant to my problem). I've followed this MSDN article to
get me started:
http://msdn.microsoft.com/library/de...ngmngsinks.asp

If you scroll down just a little bit in that tutorial, you can see 'To
build the interop'. This creates a EventInterop.dll from a C++ idl file
or something (I don't know that much about it). The next step, 'To build
the wrappers', creates an EventWrappers.dll file from the
EventInterop.dll file, using that little script as shown below in the
MSDN.

I add these to my project, I set the 'Register for COM Interop' in my
project properties to 'true' and I can build my project, can install it
as an Exchange Sink, and it works flawlessly.

Now comes the problem. I need to get this project to a machine other than
my developement machine. This other machine has the .NET framework SDK
installed.
- First, I set the 'Register for COM Interop' to false.
- I copied all the output files to the target machine.
- When I try to register my output dll *on the target machine using
regsvcs.exe*, I get the error 'the assembly (my project output dll) does
not have a strong name'.
- I went back to my developement machine, and forced my output dll to
have a strong name, creating a key with sn.exe, adding it in the project
properties and assemblyinfo.cs. But now *on compiling*, I get the error
'EventWrappers.dll' does not have a strong name.
- When I take a look at the properties of each of the two dll files
created as in the MSDN article, I can clearly see that EventInterop.dll
has the 'strong name' property value set to 'true', while the
EventWrappers.dll has it set to 'false'. So I was thinking of giving the
EventWrappers.dll a strong name.
- I used tlbimp.exe to give the EventWrappers.dll a strong name. However,
it gives the error 'EventWrappers.dll is not a valid type library'.
- I tried using tlbimp.exe on the EventInterop.dll and create an output
EventWrappers.dll, but I get the same error.
- I can't use tlbimp.exe on the 'default' EventWrappers.dll because that
one doesn't even exist (since it is created in the way as described in
the MSDN article).

So concluded: I need my output dll to be strong, but as soon as I force
it to have strong name, it won't compile because of EventWrappers.dll not
being strong, and I can't force that one to be strong.

So my obvious question is: how do I fix this? Can you change something in
the MSDN article EventWrappers.dll creation to give it a strong name
right away? Any other .NET tools that can fix this? Since I've been stuck
for too long and have no idea how to continue, help is much, much
appreciated :)

Thanks in advance,

Razzie
"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.com...
OK. Take a step back from it for a minute, and describe your Solution.

* The final output / aim of the solution, e.g. windows forms program
called
*****.exe, web application, .NET DLL to be installed as development
tool, etc.
* What projects it contains, their names, types and which depend on each
other
* The already-built / binary dependencies of each project, their type
(e.g.
COM DLL, .NET DLL), and what their functionality is / reason they're
used.
* What you've been doing that you expect to work but doesn't, and why
you
expect it to work.

But please write a list / bullets, not prose.


"Razzie" wrote:

Willy,

I tested this and sorry to say but it does not work.

I get the error 'assembly (EventWrappers) is not a strong name' when
compiling my porject, after forcing my output dll to be strong in
VS.NET.
This was necessary or else I'd get the same error when trying to
register my
output COM DLL on the other machine using regsvcs.exe (I take it I
still
need to do that in order to deploy my project on the other machine).

Any other ideas? :)

Razzie

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
>
> "Razzie" <ra****@quicknet.nl> wrote in message
> news:ed**************@TK2MSFTNGP12.phx.gbl...
>> Hi Nicholas,
>>
>> That is... not possible. Would you please take a look at this?
>> http://msdn.microsoft.com/library/de...ngmngsinks.asp
>> If you scroll just a little bit down, you will see 'To build the
>> interop'. This produces number one of my interops... that is the
>> strong
>> one.
>> In the step that follows, 'To build the wrappers', the
>> Microsoft.Exchange.Transport.EventWrappers.dll is the weak library.
>>
>> I can't use tlbimp on that one. Yet the MSDN article tells me to
>> build it
>> using that example. But it ain't strong, and since I have little
>> knowledge what tlbimp etc really does, I don't know if this can be
>> fixed?
>>
>> Razzie
>
> Hmm... there is only one interop assembly -
> Microsoft.Exchange.Transport.EventInterop.dll.
> The other - Microsoft.Exchange.Transport.EventWrappers.dll - is your
> wrapper dll a normal .NET assembly exposing COM interfaces, this one
> should (optionally) be strong named, and registered using regasm.exe
> with
> /tlb and /codebase options. The /tlb option forces the typelib to be
> created (see xxx.tlb after execution of regasm) and registered, the
> /codebase option is used if you don't want your assembly to be stored
> in
> the GAC. If you need to install the assembly in the GAC run
> gacutil.exe
> (note: only available when the .NET sdk is installed on the machine).
> So in your case just run:
>
> regasm /codebase /tlb Microsoft.Exchange.Transport.EventWrappers.dll
> note - that when running this on a non strong named assembly you
> should
> get a warning, but in general this can be safely ignored.
> - don't use regsvcs.exe, this tool is meant to register and
> install
> COM+ ( Enterprise Services derived ) class objects.
> - Make ABSOLUTELY sure the COM dll from which you created the
> interop assembly Microsoft.Exchange.Transport.EventInterop.dll is is
> also
> installed and registered.
> Willy.
>
>
>
>



Nov 16 '05 #12
A few questions.
"Razzie" <ra****@quicknet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Willy,

First of all thank you for your determination to help me, I really
appreciate it.

I did what you told me to, and although everything completed without an
error, I think I still miss a final thing.
If I install the dll on the other machine, nothing seems to be happening.
On my developement machine, after compiling and binding it to my smpt
server, I can see that it works when I communicate with my SMTP server,
and a log file is created, etc.
On the target machine, I use the regasm too, it completes succesfully,
bind it to the smtp server, which also says that everything is ok, but
nothing happens after that. The SMTP server there behaves as before, no
log file created, etc.

So, can I somewhere see that the dll is 'running' somewhere, either in
registry, or in Com Applications, etc? Or do I miss a final step?

What OS are you running on your development and on your deployment machine ?
What scares me a bit is that you are talking about your "smtp server", does
it mean you only have smtp running on your development system?
What kind of smtp server is it? W2K/W2K3 or Exchange Server?

Willy.

PS. I cross-posted and propose to move this thread to:
Microsoft.public.dotnet.framework.interop

Nov 16 '05 #13
Developement machine: WinXP, VS.NET, only SMTP
Deployement machine: Win2000, Exchange2000, SMTP, .NET Framework SDK

The MSDN article says it applies to Windows 2000, Exchange 2000 server,
VS.NET. Since it works on my developement machine with no Exchange and
WinXP, I don't have a reason to assume it won't work on my deployement
machine with Exchange 2000 and Win2000, especially since I didn't edit the
code to make it work on my WinXP machine.

When I telnet to the SMTP server on both machines, they both say Microsoft
ESMTP server, only difference is 5.5 and 6.1 or something, not SMTP server
3.4 and Exchange SMTP server 8.0 or something :)

Do you see something amiss?
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:u0**************@TK2MSFTNGP14.phx.gbl...
A few questions.
"Razzie" <ra****@quicknet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Willy,

First of all thank you for your determination to help me, I really
appreciate it.

I did what you told me to, and although everything completed without an
error, I think I still miss a final thing.
If I install the dll on the other machine, nothing seems to be happening.
On my developement machine, after compiling and binding it to my smpt
server, I can see that it works when I communicate with my SMTP server,
and a log file is created, etc.
On the target machine, I use the regasm too, it completes succesfully,
bind it to the smtp server, which also says that everything is ok, but
nothing happens after that. The SMTP server there behaves as before, no
log file created, etc.

So, can I somewhere see that the dll is 'running' somewhere, either in
registry, or in Com Applications, etc? Or do I miss a final step?

What OS are you running on your development and on your deployment machine
?
What scares me a bit is that you are talking about your "smtp server",
does it mean you only have smtp running on your development system?
What kind of smtp server is it? W2K/W2K3 or Exchange Server?

Willy.

PS. I cross-posted and propose to move this thread to:
Microsoft.public.dotnet.framework.interop


Nov 16 '05 #14
I posted my reply in the other newsgroup, thanks.

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:u0**************@TK2MSFTNGP14.phx.gbl...
A few questions.
"Razzie" <ra****@quicknet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Willy,

First of all thank you for your determination to help me, I really
appreciate it.

I did what you told me to, and although everything completed without an
error, I think I still miss a final thing.
If I install the dll on the other machine, nothing seems to be happening.
On my developement machine, after compiling and binding it to my smpt
server, I can see that it works when I communicate with my SMTP server,
and a log file is created, etc.
On the target machine, I use the regasm too, it completes succesfully,
bind it to the smtp server, which also says that everything is ok, but
nothing happens after that. The SMTP server there behaves as before, no
log file created, etc.

So, can I somewhere see that the dll is 'running' somewhere, either in
registry, or in Com Applications, etc? Or do I miss a final step?

What OS are you running on your development and on your deployment machine
?
What scares me a bit is that you are talking about your "smtp server",
does it mean you only have smtp running on your development system?
What kind of smtp server is it? W2K/W2K3 or Exchange Server?

Willy.

PS. I cross-posted and propose to move this thread to:
Microsoft.public.dotnet.framework.interop


Nov 16 '05 #15
It works! :)

Willy, apparantly I didn't read the /codebase switch before - now that I
used it, everything works fine, I'm extremely happy, thanks.
Final thing: I read
(http://dotnetjunkies.com/Newsgroups/.../27/40357.aspx)
that /codebase should NEVER be used - after so many problems I'm a little
bit like 'uhu, whatever' now. Do you know the chance of problems occuring
when using /codebase and is it really that bad?
"Razzie" <ra****@quicknet.nl> wrote in message
news:e2**************@TK2MSFTNGP14.phx.gbl...
Developement machine: WinXP, VS.NET, only SMTP
Deployement machine: Win2000, Exchange2000, SMTP, .NET Framework SDK

The MSDN article says it applies to Windows 2000, Exchange 2000 server,
VS.NET. Since it works on my developement machine with no Exchange and
WinXP, I don't have a reason to assume it won't work on my deployement
machine with Exchange 2000 and Win2000, especially since I didn't edit the
code to make it work on my WinXP machine.

When I telnet to the SMTP server on both machines, they both say Microsoft
ESMTP server, only difference is 5.5 and 6.1 or something, not SMTP server
3.4 and Exchange SMTP server 8.0 or something :)

Do you see something amiss?
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:u0**************@TK2MSFTNGP14.phx.gbl...
A few questions.
"Razzie" <ra****@quicknet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Willy,

First of all thank you for your determination to help me, I really
appreciate it.

I did what you told me to, and although everything completed without an
error, I think I still miss a final thing.
If I install the dll on the other machine, nothing seems to be
happening. On my developement machine, after compiling and binding it to
my smpt server, I can see that it works when I communicate with my SMTP
server, and a log file is created, etc.
On the target machine, I use the regasm too, it completes succesfully,
bind it to the smtp server, which also says that everything is ok, but
nothing happens after that. The SMTP server there behaves as before, no
log file created, etc.

So, can I somewhere see that the dll is 'running' somewhere, either in
registry, or in Com Applications, etc? Or do I miss a final step?

What OS are you running on your development and on your deployment
machine ?
What scares me a bit is that you are talking about your "smtp server",
does it mean you only have smtp running on your development system?
What kind of smtp server is it? W2K/W2K3 or Exchange Server?

Willy.

PS. I cross-posted and propose to move this thread to:
Microsoft.public.dotnet.framework.interop



Nov 16 '05 #16
You've completely lost me - I understand COM, but COM+ is completely alien to
me. And the term 'Exchange Event Sink', makes me completely none the wiser as
to what the program is actually supposed to do.

Nov 16 '05 #17

"Razzie" <ra****@quicknet.nl> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
It works! :)

Willy, apparantly I didn't read the /codebase switch before - now that I
used it, everything works fine, I'm extremely happy, thanks.
Final thing: I read
(http://dotnetjunkies.com/Newsgroups/.../27/40357.aspx)
that /codebase should NEVER be used - after so many problems I'm a little
bit like 'uhu, whatever' now. Do you know the chance of problems occuring
when using /codebase and is it really that bad?


No it isn't that bad, as long as you know what you are doing ;-).
What the article suggests - /codebase should NEVER be used - is wrong, it
should read -/codebase should NEVER be used when deploying unless the
assembly is strong named.
But here we come back to another issue, you can't sn your assembly because
it is referencing another assembly that has no sn.
You should solve this issue first, so you can sn your IA and then you can
safely use regasm /codebase.

Willy.

Nov 16 '05 #18
hehe, but since I know of NO way to solve that strong name problem, it seems
I don't have any choice and I might take the risk... :)

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...

"Razzie" <ra****@quicknet.nl> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
It works! :)

Willy, apparantly I didn't read the /codebase switch before - now that I
used it, everything works fine, I'm extremely happy, thanks.
Final thing: I read
(http://dotnetjunkies.com/Newsgroups/.../27/40357.aspx)
that /codebase should NEVER be used - after so many problems I'm a little
bit like 'uhu, whatever' now. Do you know the chance of problems occuring
when using /codebase and is it really that bad?


No it isn't that bad, as long as you know what you are doing ;-).
What the article suggests - /codebase should NEVER be used - is wrong, it
should read -/codebase should NEVER be used when deploying unless the
assembly is strong named.
But here we come back to another issue, you can't sn your assembly because
it is referencing another assembly that has no sn.
You should solve this issue first, so you can sn your IA and then you can
safely use regasm /codebase.

Willy.

Nov 16 '05 #19
That makes 2 people who are completely lost ;)

"Patty O'Dors" <Pa********@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
You've completely lost me - I understand COM, but COM+ is completely alien
to
me. And the term 'Exchange Event Sink', makes me completely none the wiser
as
to what the program is actually supposed to do.

Nov 16 '05 #20


"Razzie" <ra****@quicknet.nl> wrote in message
news:OV*************@TK2MSFTNGP11.phx.gbl...
hehe, but since I know of NO way to solve that strong name problem, it
seems I don't have any choice and I might take the risk... :)


It must be possible to sn the 'wrapper' assembly for sure using the same snk
file as used to sn the 'interop' assembly.

Willy.
Nov 16 '05 #21

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mario | last post: by
25 posts views Thread by Yves Glodt | last post: by
32 posts views Thread by Adrian Herscu | last post: by
14 posts views Thread by Patrick Kowalzick | last post: by
399 posts views Thread by =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post: by
12 posts views Thread by puzzlecracker | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.