Register an assembly in COM+ from Visual Studio .NET#

You know when you have an assembly with serviced components that needs to be registered in COM+, you have to open up a .NET Command Prompt, navigate to the proper directory and call Regsvcs.exe with the name of the dll you want to register?

I just thought of a really simple trick that handles this with two clicks from within Visual Studio .NET (everybody else has probably already figured this out but somehow forgotten to tell me).

Just add an external tool - I cunningly called it "Register Output Assembly In COM+" - with the command pointing to Regsvcs.exe (e.g. "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\RegSvcs.exe") and with "$(TargetPath)" as its arguments.

Now when you run the external tool, it will just register the output assembly of your current project in the COM+ catalog. I also made it use the output window so I see the results right there in Visual Studio .NET as well.

Blog | Programming | .NET | VS.NET
Thursday, October 28, 2004 10:02:27 AM (Romance Standard Time, UTC+01:00)
Small note: you can also do this by adding this line in the post-build event.
Each build will then register the just build component ...
Off course, it is also good to unregister before you do this each time.
Thursday, October 28, 2004 10:09:03 AM (Romance Standard Time, UTC+01:00)
Yes you're right, you could do this in the post-build event but that doesn't work for all project types: e.g. Visual Basic .NET projects don't have a post build step.

Also, this tool is permanently available in my Visual Studio now, not something I need to add to every new project.

Furthermore, registering the assembly in COM+ only needs to happen once (if you set up the GUIDs properly) so I don't need/want the overhead of doing that on every build.

So I still like this better :-)
Comments are closed.
All content © 2012, Jelle Druyts
On this page

Recent Photos
www.flickr.com
This is a Flickr badge showing public photos from Jelle Druyts. Make your own badge here.
Advertising
Top Picks
Statistics
Total Posts: 350
This Year: 0
This Month: 0
This Week: 0
Comments: 530
Archives
Sitemap
Disclaimer
This is my personal website, not my boss', not my mother's, and certainly not the pope's. My personal opinions may be irrelevant, inaccurate, boring or even plain wrong, I'm sorry if that makes you feel uncomfortable. But then again, you don't have to read them, I just hope you'll find something interesting here now and then. I'll certainly do my best. But if you don't like it, go read the pope's blog. I'm sure it's fascinating.

Powered by:
newtelligence dasBlog 2.0.7226.0

Sign In