green field

Setting Up Your Own Projects for Custom Development

The notes here are meant to answer the question: How do I setup my projects so that I can work with mojoPortal from svn trunk and keep my own code in my own repository. Some of this material is also covered in a training video, but the quality of that particular video is not good, hopefully I'll find time to do a better one soon.

To keep your stuff separate and use your own source control repository is fairly easy. First checkout mojoportal svn trunk, all the mojoportal projects come down in their own folders. Create your own top level folder named MyProjects (for example) so that this folder is a top level folder at the same level as the other mojoportal project folders. Next copy one of the .sln files in the root and rename it like mymojo.sln or whatever. This .sln file is the only file that will not be under any source control but its not a big deal as it is easy to re-create if you ever lost it. The reason it can't be under source control is because its has to live in the root folder which is covered by the mojoportal source control. Create your projects inside the MyProjects folder so you may have something like:

MyProjects/Web.UI (a Web Application Project)
MyProjects/Business (a class library project)
MyProjects/Data.MSSQL (a class library)

Now everything in the MyProjects folder can be managed by your source control and only the .sln fille can't be because it lives in the root folder. Now if you need to share the .sln file you could make a copy and paste it into your folder, add it to your source control for safe keeping with instructions for others to copy it to the root to use it.

Your Web.UI project must be a Web Application project, but you will never run it directly, you will always debug using the mojoportal web project but you will still be able to step through the code. The trick is to use a post build event to copy the needed files up to the Web folder. Look at the post build event in the WebStore.UI project for an example. You will need to reference the mojoPortal.Web project and other projects like mojoPortal.Business from your Web.UI project

You will also need to have a few things in place to make sure everything compiles ok in your Web.UI project. You'll need to copy the whole pages section from the mojoportal Web.config into your project's Web.config. You'll need to create a folder named App_MasterPages and create a dummy master page there named layout.master. It must have the same content placeholders as the one in the mojoportal web project.

During development you will always be running the mojoportal web project as the main project. You can set breakpoints in your code and debug with no problem but mojoportal web must be the startup project. Working in this mode keep in mind that if you make a change in your .aspx or .ascx files you won't see the change until you build your Web.UI project because its the post build event which will copy your files up to the mojoportal Web folder and the ones there are the ones actually used at runtime.

Within your Web.UI project its best to create a folder to contain all your pages and controls so that this folder is copied up under the mojoportal Web and all of your .aspx and .ascx files are there. So you might have a folder like this:

Web.UI/MyCoolFeature

and when the post build copies it up to the Web folder it lands at:

Web/MyCoolFeature

Try to use a unique name for your folder to avoid future clashes with mojoPortal features. Make sure you don't copy things like the Web.config file from your project up to the mojopotal Web, its not needed there and overwriting the real one will be a problem.

Event Calendar Pro a better event calendar for mojoportal
 
Vote for mojoPortal in the 2008 CMS Awards