giving interop a strong name

D

Dave Brown

Hi all

I'm trying to build an applicaiton that references to the interop quartzlib
so i can use directshow within my app.
My Applicaiton has a strong name so therefore the referenced dll also has to
have one, I've seen in the newsgroups about specifying the wrapper assembly
key file property in the project properties but it doesnt make a difference.
Even after removing the reference and adding it again...
Any Ideas anyone ?

PS. from my assembly.cs the keyfile is referenced as
[assembly: AssemblyKeyFile("..\\..\\keypair.snk")]

I've tried putting the whole path to keypair.snk in the property, the path
with " marks, just the name, the ..\\..\\ notation as above but nothing
seems to set the referenced dll to being strong named also ....



Rgds,


Dave.
 
N

Nicholas Paldino [.NET/C# MVP]

Dave,

By default, VS.NET doesn't strong name the assemblies that are created
for interop when you add a reference. Because of this, you will have to
create the interop assemblies yourself. You can run TLBIMP or AXIMP
(depending on the reference you want to add). Using those tools, you can
specify a key file to use to sign the assembly. At that point, you can add
the reference to the new interop assembly.

Hope this helps.
 
S

Sam Gentile [MVP - C#/.NET]

Correct Nicholas, and Dave, if you want to learn more about using TLBIMP,
SN, TLBEXP, and REGASM (the command line Interop tools), you can check out
my 2nd COM Interop article in my MSDN column which specifically dives into
these tools:
http://msdn.microsoft.com/netframew...brary/en-us/dndotnet/html/useframewktools.asp

--
-----
Sam Gentile
Microsoft MVP - C#/.NET
..NET Blog http://samgentile.com/blog/

Please do NOT contact me directly but respond to
the newsgroup instead.
---------
Nicholas Paldino said:
Dave,

By default, VS.NET doesn't strong name the assemblies that are created
for interop when you add a reference. Because of this, you will have to
create the interop assemblies yourself. You can run TLBIMP or AXIMP
(depending on the reference you want to add). Using those tools, you can
specify a key file to use to sign the assembly. At that point, you can
add
the reference to the new interop assembly.

Hope this helps.


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

Dave Brown said:
Hi all

I'm trying to build an applicaiton that references to the interop quartzlib
so i can use directshow within my app.
My Applicaiton has a strong name so therefore the referenced dll also has to
have one, I've seen in the newsgroups about specifying the wrapper assembly
key file property in the project properties but it doesnt make a difference.
Even after removing the reference and adding it again...
Any Ideas anyone ?

PS. from my assembly.cs the keyfile is referenced as
[assembly: AssemblyKeyFile("..\\..\\keypair.snk")]

I've tried putting the whole path to keypair.snk in the property, the
path
with " marks, just the name, the ..\\..\\ notation as above but nothing
seems to set the referenced dll to being strong named also ....



Rgds,


Dave.
 
D

Dave Brown

I decided to use the mediaplayer 9 sdk instead of directshow as I wasnt
having any luck with tlbimp either.

Now my usercontrol wont show at all, And I have a ?fusionbindlog file
present due to a TargetInvocationException being thrown. Which I presume is
because the control cannot somehow instantiate mediaplayer.

Why is it such a battle just to do something so usually non-dramatic as
playing a sound. ?

Somethings I love with .NET , other things are proving to be very tiresome..
same with any language tho I suppose.
 
S

Sam Gentile [MVP - C#/.NET]

Now my usercontrol wont show at all, And I have a ?fusionbindlog file
present due to a TargetInvocationException being thrown

Can you show us the fusionbindinglog so I can see what Fusion is not
loading? I know that with Interop at least, if you strong name one assembly,
all the assemblies that it references or depends on must also be strong
named. This is sometimes difficult with legacy MSFT unmanaged stuff as they
have not provided many PIAs for the unmanaged stuff other than Office.

--
-----
Sam Gentile
Microsoft MVP - C#/.NET
..NET Blog http://samgentile.com/blog/

Please do NOT contact me directly but respond to
the newsgroup instead.
---------
Dave Brown said:
I decided to use the mediaplayer 9 sdk instead of directshow as I wasnt
having any luck with tlbimp either.

Now my usercontrol wont show at all, And I have a ?fusionbindlog file
present due to a TargetInvocationException being thrown. Which I presume
is
because the control cannot somehow instantiate mediaplayer.

Why is it such a battle just to do something so usually non-dramatic as
playing a sound. ?

Somethings I love with .NET , other things are proving to be very
tiresome..
same with any language tho I suppose.



Dave Brown said:
Hi all

I'm trying to build an applicaiton that references to the interop quartzlib
so i can use directshow within my app.
My Applicaiton has a strong name so therefore the referenced dll also has to
have one, I've seen in the newsgroups about specifying the wrapper assembly
key file property in the project properties but it doesnt make a difference.
Even after removing the reference and adding it again...
Any Ideas anyone ?

PS. from my assembly.cs the keyfile is referenced as
[assembly: AssemblyKeyFile("..\\..\\keypair.snk")]

I've tried putting the whole path to keypair.snk in the property, the
path
with " marks, just the name, the ..\\..\\ notation as above but nothing
seems to set the referenced dll to being strong named also ....



Rgds,


Dave.
 
D

Dave Brown

I followed the guide in the Media Player SDK for configuring media player to
work with my .Net application.

The fusion log is as follows... Thanks Sam.

URL: http://www.eztrea.com/findit/WebGps2.dll
Zone: 2
Assembly Name: WebGps2.dll
Type Name: WebGps2.UserControl1



----- Thrown Exception -----


System.Reflection.TargetInvocationException: Exception has been thrown by
the target of an invocation. ---> System.Security.SecurityException: Request
failed.
at WebGps2.UserControl1.InitializeComponent()
at WebGps2.UserControl1..ctor()
--- End of inner exception stack trace ---

Server stack trace:
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Activator.CreateComInstanceFrom(String assemblyName, String
typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String
typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(Met
hodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessa
ge msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String
typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
at Microsoft.IE.SecureFactory.CreateInstanceWithSecurity(Int32 dwFlag,
Int32 dwZone, String pURL, String uniqueIdString, String link, String
licenses)


Sam Gentile said:
Now my usercontrol wont show at all, And I have a ?fusionbindlog file
present due to a TargetInvocationException being thrown

Can you show us the fusionbindinglog so I can see what Fusion is not
loading? I know that with Interop at least, if you strong name one assembly,
all the assemblies that it references or depends on must also be strong
named. This is sometimes difficult with legacy MSFT unmanaged stuff as they
have not provided many PIAs for the unmanaged stuff other than Office.

--
-----
Sam Gentile
Microsoft MVP - C#/.NET
.NET Blog http://samgentile.com/blog/

Please do NOT contact me directly but respond to
the newsgroup instead.
---------
Dave Brown said:
I decided to use the mediaplayer 9 sdk instead of directshow as I wasnt
having any luck with tlbimp either.

Now my usercontrol wont show at all, And I have a ?fusionbindlog file
present due to a TargetInvocationException being thrown. Which I presume
is
because the control cannot somehow instantiate mediaplayer.

Why is it such a battle just to do something so usually non-dramatic as
playing a sound. ?

Somethings I love with .NET , other things are proving to be very
tiresome..
same with any language tho I suppose.



Dave Brown said:
Hi all

I'm trying to build an applicaiton that references to the interop quartzlib
so i can use directshow within my app.
My Applicaiton has a strong name so therefore the referenced dll also
has
to
have one, I've seen in the newsgroups about specifying the wrapper assembly
key file property in the project properties but it doesnt make a difference.
Even after removing the reference and adding it again...
Any Ideas anyone ?

PS. from my assembly.cs the keyfile is referenced as
[assembly: AssemblyKeyFile("..\\..\\keypair.snk")]

I've tried putting the whole path to keypair.snk in the property, the
path
with " marks, just the name, the ..\\..\\ notation as above but nothing
seems to set the referenced dll to being strong named also ....



Rgds,


Dave.
 

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