Created By
DMG Development
As Seen On

Main Page  |  Forums  |  Register  |  Active Topics  |  Members  |  Search

 
Username:
Password:
DMG Forums >> DMG Forums Discussion >> Tutorials & HOWTO Articles >> Modifying & Compiling The DMG Forums Source Code
Modifying & Compiling The DMG Forums Source Code
Author Topic
grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 9/20/2007 8:11:57 AM

Now that DMG Forums is a completely open source application, many of the topics on this web site deal with customizations and modifications that are made to the core code. This article is intended to give the basics on how the DMG Forums source code is edited and compiled. This is the process that we use when compiling new code. We do not utilize tools such as Visual Studio or other integrated development environments, but other users of the application have. We welcome our users to post information on how they have imported our code into one of these programs.



Compiling Using VBC.exe

The DMG Forums application is written in Visual Basic .NET. The latest VB.NET compiler is used to compile the code, without the use of a complicated IDE environment. This saves useless code and allows for full access to the core. Some .NET developers are unfamiliar with compiling their code directly, as this is a common task performed by Visual Studio and other IDE programs. To compile the code directly, make sure you have the latest version of the .NET framework (you won't need the SDK) on your development machine. You will need to locate the compiler executable directly. At the time of this tutorial, we are running .NET v2.0.50727, which is located in the following directory.

C:\Windows\Microsoft.NET\Framework\v2.0.50727

The folder structure should be similar on your development machine. You may also have other directories above this one where previous versions of the framework are located. The file you are looking for is VBC.exe. This is the VB.NET compiler application. This is what Visual Studio .NET calls behind the scenes to build your applications when you press the compile button. For DMG Forums, this process is done manually.



Adding VBC.exe To The Windows Path

To call the VB.NET compiler from the command line without having to type the full path, always make sure the latest .NET framework directory is in your Windows PATH variable. To do this, right click on your My Computer icon and click Properties. Go to the Advanced tab and click the Environment Variables button. This will bring you to a window that looks like the following.



In the System Variables section at the bottom, find the "Path" variable. Double-click this line to modify the Windows path. You should see numerous other directories in the path variable. Make sure there is a semicolon at the end of the line and add your .NET Framework path to the variable. This is the directory that we located above where VBC.exe is located. After the .NET Framework location is added to the path variable, press OK to close all of the windows.



Using Compile.bat

DMG Forums comes with a batch file included that will automatically compile all of the .VB files and will place the compiled DLL's in the /bin folder. To use Compile.bat, make sure the latest VBC.exe is in your path variable and make sure that all of the application's .VB files and Compile.bat are in the /SOURCE directory of your application. Make sure you back up the DLL files in your /bin directory because Compile.bat will overwrite them.

Open a command prompt on your development machine and browse to the directory where your DMG Forums application is stored. When you are in the /SOURCE directory, just type "Compile" into the command line and the batch file will execute. It will call VBC.exe several times for each source code file that comes with the application. If the batch file runs correctly, you will have all new DLL files in your /bin directory.



Inside Compile.bat

The current Compile.bat that is shipped with DMG Forums contains the following commands.

vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,Microsoft.VisualBasic.dll /out:..\bin\Global.dll Global.vb
vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,Microsoft.VisualBasic.dll,System.Xml.dll,../bin/Global.dll /out:..\bin\DMG.dll DMG.vb
vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,Microsoft.VisualBasic.dll,../bin/Global.dll /out:..\bin\Forums.dll Forums.vb
vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,Microsoft.VisualBasic.dll,System.Xml.dll,../bin/Global.dll /out:..\bin\Topics.dll Topics.vb
vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,Microsoft.VisualBasic.dll,System.Xml.dll,../bin/Global.dll /out:..\bin\Members.dll Members.vb
vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,Microsoft.VisualBasic.dll,System.Drawing.dll,../bin/Global.dll /out:..\bin\Upload.dll Upload.vb
vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,../bin/Global.dll /out:..\bin\Admin.dll Admin.vb
vbc /nologo /t:library /r:System.dll,System.web.dll,System.Data.dll,Microsoft.VisualBasic.dll,../bin/Global.dll /out:..\bin\Setup.dll Setup.vb

The first command compiles Global.dll, which contains the main classes that are used by the entire application. The subsequent commands compile the remaining source files. Take note that /bin/Global.dll is a reference for each of the other compiled sources. Also take note of the use of "../" in the paths. When the compiler is run, it will jump out of the /SOURCE directory and up to the root directory of your application. The DLL files in your /bin folder WILL be overwritten.



Final Notes

This article is intended to get you on your way to successful modifications to the DMG Forums core. If you are able to compile your own set of DLL files successfully, all you will need is some VB.NET and ASP.NET knowledge from that point forward to create your own additions to this application.

When you deploy your web site into production, be sure to remove the /SOURCE directory. The only thing needed for your live site is the /bin folder with the DLL files contained in it. All source code and compilers should stay on your local development machine.

  Copyright DMG Development DMG Forums 3.2