Compiling VB (.NET) files located in different directories

pukya78

Member
Joined
Jun 5, 2006
Messages
15
Programming Experience
Beginner
Hi,
I am having to vb files. One is located under C:/VB/main and the other is under C:/VB/class.
File under main looks like:

<code>
Module Module1
Sub Main()

Dim test As New Test1

End Sub

End Module
</code>
The class Test1 is defined in the file (class_test.vb) under class directory. When I compile the code, I get an error saying Test1 is not defined. This is because class_test.vb is located in some other directory.
Any idea how this can be resolved? I want to main the directory structure.

Regards,
P
 
I got that to work using the Solution Explorer. Instead of using Windows Explorer to create new folders, I used the Solution explorer.

I have one more question: Like in C, for every file we get an .obj
created. All these object files then get linked to the final dll/exe.
Is there a similar process in VB.NET? What I mean by this is; is there
a way that I can build each folder individually and then combine
everything to get my final exe?

Regards,
P
 
Yes, when you look in solution explorer, if a folder is included in your project, it is in yellow.. if it is not included then it is is white/transparent/ghost kind of look..

Try it with a project... Open some project and in the solution explorer, click the Show All Files button.. its in the row of buttons at the top of solutione xplorer.. second from left, looks like 3 documents stacked on top, the back one is ghosted.

And then you will see other folders in your project like BIN and OBJ.. they are ghosted because they arent part of it.. You can right click items and choose Include or Exclude from project.. they go yellow/ghosted accordingly..
Items you make in SE are automatically included in project.. whereas items you make in explorer are automatically excluded by default.
 
pukya78 said:
What I mean by this is; is there
a way that I can build each folder individually and then combine
everything to get my final exe?

no. the compiler builds and links automatically. why would you do this? If you want to build in stages, use DLLs
 
You mean to say that create a separate dll for each folder and then link them? How do I create the dll?

Thanks and Regards,
P
 
Create a project for each DLL, of type Class Library. Write the functionality, build the dll.

Then you have 2 choices. Either you include a reference to the generated DLL file or you add the DLL project to your solution and create a reference to it.

With either method you can debug and change the DLL code (quite nifty really.. ) but with the latter method you can see the files that comprise the DLL in front of you. With the add-the-DLL method, you only really see the source code for the DLL if you step into it while debugging. In this case, I think VS finds and opens the source code for you.. If you dont have it, it doesnt disassemble (as far as im aware)
 
Back
Top