Problem accessing namespace in Visual Studio 2010 add-in
I've been tasked with turning a preexisting project into an add-in. The current project is a class library. In the add-in, I added the CL project as a reference. In the add-in's Co开发者_JS百科nnect class' Exec method, I tried adding the following code to open the entry point for the CL:
var form = new CLNameSpace.MainForm();
form.Show();
Where CLNameSpace (renamed for this article) is the namespace being referenced from the CL project. It is also in the using
block at the top of the code. I tried this answer's method to get the fully qualified name and it is correct. I do not get any build or run-time errors but something is wrong. Using the Immediate Window to instantiate the two lines above by hand, I get the following error message:
The type or namespace name 'CLNameSpace' is not valid in this scope
How do I get around this namespace visibility issue? I wonder if it's some kind of configuration in CLNameSpace (if that's even possible.)
You probably would have to do something like this:
var form = new CLNameSpace.MainForm();
form.Show();
Note that Application.Run
would start a standard application message loop - but your main application already has a message loop so trying to start another message loop will not produce any meaningful result.
精彩评论