views:

78

answers:

2

I am trying to deploy a .NET COM interop dll for a web application. During development, for the assembly that needs to register for COM interop, I have the "Register for COM interop" option checked under build properties. In this method, everything works just fine.

However, when I deploy the ASP.NET application and try to register the assembly manually using the regasm tool, it doesn't work. :(

My end goal is this:

Once the user comes to the site and does not have the object registered, user can register the dll using ClickOnce. Thereafter, user should not get prompted for anything and everything should just work!

Thank you in advance.

A: 

Can't help you with the ClickOnce stuff, but could it be you need to use the /codebase option for regasm (if you're not installing it into the GAC), ex.

regasm AssemblyName.dll /codebase

You will also need to be an admin for that to work under Vista/Windows 7.

Paul Mrozowski
+1  A: 

As you might expect, a web app that tries to install a COM DLL on the client machine is going to face many security obstacles. It is possible for a user without admin privilege to install .NET code (including COM-visible classes) via ClickOnce, but I think you might find even this does not achieve what you want...

ClickOnce installations are deployed to an obscure location underneath the user's profile section of the filesystem. Any COM components in the deployed app are visible within the app, but are not visible elsewhere on the client machine. In particular, client script running in a browser will not be able to invoke COM components deployed via ClickOnce.

ClickOnce deployment quite deliberately keeps deployed code separate from the rest of the system.

I can't see any way for your web app to deploy and then interact with a COM DLL, unless the user has admin privilege and explicitly registers the DLL. In general, I think this is a good thing.

Somebody else might have a better suggestion, but the only way forward I can see is for you to build the functionality that uses this DLL into a .NET app that runs on the desktop. This could be deployed via ClickOnce, and invoked via a link in your web app. It could even post data to your web server. But I can't see a way for it to interact with the browser.

Martin
Thank you sir! Your perception and knowledge have helped me find my way towards the solution.
Paranoid Android