Reputation: 415
In Visual Studio, I have a solution containing both a Visual Basic (VB) project (called WindowsVB) and a C# project (called Windows_C_Sharp). Within the C# project, I want to use classes/modules declared in the VB project.
I know there are other questions and answers addressing this issue, but as far as I see I have followed these answers correctly, and it still doesn't work.
The following screen print shows what goes wrong. As you can see, I have added the reference to the VB project (as seen in the solution explorer to the left). But when I try to import the VB project into my C# class (in this case it's actually the main method in program.cs) with a 'using' statement, that VB project isn't recognized - as indicated by the red underlining of the word 'using', as well as by the error ("type or namespace WindowsVB could not be found") shown in the Error List window.
Here's the screen print (click to enlarge):
As mentioned here: How to call a function written in VB from C# application in the answer provided by the user called 'awe', by default the namespace to be imported is the name of the VB project.
So my question is, what am I doing wrong here? Why isn't the namespace provided for the VB project (again, that namespace being the name of that project) recognized?
Upvotes: 0
Views: 888
Reputation: 54477
The project name and the root namespace are two different things. When you create a project and name it, that name is used for the default namespace too, but it's still store in a different location. If you change the name of the project, the root namespace is unaffected. It must be changed separately in the project properties.
Upvotes: 1