I've created a .NET 2 COM+ component to be consumed by our archaic classic ASP website. This is done quite simply in classic ASP...
Dim MenuManager : Set MenuManager = Server.CreateObject("MenuManager.MenuManager")
However, I want to performance profile the component using a C# console application.
How do I call this from within the C# console application?
You are using late binding with the CreateObject() function. You want to steal, beg or borrow a copy of VS2010 to use the C# 4.0 dynamic keyword to make that easy to do. Here's similar code that works on any machine. It uses late binding to create the FileSystemObject COM component, the first two lines are equivalent to your code snippet. It lists the subdirectories of the c:\windows folder:
using System;
class Program {
static void Main(string[] args) {
var type = Type.GetTypeFromProgID("Scripting.FileSystemObject");
dynamic obj = Activator.CreateInstance(type);
dynamic win = obj.GetFolder("c:/windows");
foreach (dynamic subwin in win.SubFolders) {
Console.WriteLine(subwin.Name);
}
Console.ReadLine();
}
}
If you can't use C# version 4 then consider using VB.NET instead. It has the same syntax and also has a CreateObject() function.