views:

91

answers:

1

Hi there

I'm using regfree com to deploy an activex component with clickonce. The component is dependent on some native dlls that should reside in the same directory as the component. If I manually copy the native dlls to the install dir of the clickonce app ( I located the directory by using System.Reflection.Assembly.GetExecutingAssembly()) the application runs fine. But if I include the dlls in the project and publish them, the application doesn't work..

Any suggestions or workarounds?

Regards,

Fredrik

A: 

Embed the native .dlls in your managed assembly as an embedded resource and extract to disk at runtime if the are not present.

If this process is not familiar to you, leave me a comment and I will make an effort to explain it. It is not that complicated.

Sky Sanders
thank you! you saved my day.. I can see that the dll's are not copied at all to the application directory..
fsl
@fsl - so you are familiar with embedding and extracting resources from an assembly?
Sky Sanders
Along the lines of Application.GetResourcePart(Uri relativeUri).. and then open a file stream to: System.Reflection.Assembly.GetExecutingAssembly()) ?
fsl
@fsl - I suppose that is one way to do it. I generally do not use the apps .rsx file. I add the native resources to my project as content and set the compilation action to Embedded Resource and then call something like `typeof(myclass).Assembly.GetManifestResourceStream(resourcePath)`. The rules for determining the resource path can be confusing but an easy way to find the resource path is to compile your assembly and then open it in Reflector and copy the path from there. But Application.GetResource... may be just fine for your needs.
Sky Sanders
thank you, I'm very appreciative! I've settled with Application.GetResourceStream and setting the compilation action to resource.. Which I guess is kosher in WPF.. :)
fsl
@fsl - my pleasure. See you round.
Sky Sanders