Working with the mojoPortal Visual Studio Solution

This article assumes you have already got the source code for mojoPortal either from the source code repository or from the file.

Tip: If working with the source code I recommend getting the code with TortoiseHG. Good work is happening all the time, why get anything less than the latest greatest version. Its generally kept stable and if any serious bug is reported it gets fixed quickly and then you can do Puul and Update to get the fix right away.

You must have Visual Studio 2010 or the free Visual Web Developer Express 2010. When developing custom projects in Visual Web Developer express, you may need to use the workaround mentioned here for App_GlobalResources.

Setup your database, either MS SQL, MySQL, or PostgreSQL, or Firebird Sql

Open the mojoportal.sln file in Visual Studio.

If you are using a database other than MS SQL (which is the default), branch down the references node under the mojoPortal.Business project and make sure it has a reference to the correct data layer for your needs. I usually check it in configured for mojoPortal.Data.MSSQL (Microsoft SQL Server) but you can easily change this. Delete the reference for mojoPortal.Data.MSSQL, then right click the References node and choose Add Reference. In the dialog,click the Projects tab and choose either mojoPortal.Data.pgsql, mojoPortal.Data.MySql  and click OK

Do the same thing for mojoPortal.Features.Business and and WebStore.Business.

Open the Web.config file in Visual Studio by browsing to the root of the mojoPortal.Web Project in Solution Explorer.

Edit the database connection string in the Web.config file. Note there are connection string settings in the Web.config for all supported databases, make sure you edit the one for the db you are using. Actually, you may prefer to put your connection string in a user.config file. Using a text editor, open the file user.config.sample (from the root of the Web folder) and save it as user.config, then edit the correct connection string in this file instead of touching the web.config. The settings in the user.config will override the settings in the web.config. This is especially handy for working from svn because you can get updated web.config settings without any conflicts. When you deploy on production delete the user.config and just use the web.config. Be aware that changes to user.config are not detected right away like changes to web.config so sometimes in order to make changes in user.config take effect, you have to type a space into web.config to change it in order for the updated user.config to be picked up.

As long as your db is setup correctly and your connection string is correct and you have set the correct reference to the Data layer you want from the mojoPortal.Business project you should be ready to go. If you got everything right you should now be able to click the Play button or choose "Start Debugging" from the Debug menu. This will compile the solution and open the site in the browser. The very first time you run it, it will throw some exceptions because there is no content yet in the db and the upgrade scripts have not yet been run. Just keep clicking  the Play button (or F5) to continue execution, it will handle the exception and check if it needs to run upgrade scripts. It will run these scripts automatically as long as you don't stop execution.

Optional IIS Web Setup

If you would rather use IIS, configure a Virtual Directory in IIS so that http://localhost/mojoportal maps to the Web folder.  Next you have to make the Data Folder beneath the Web writable by the ASP.NET worker process. Right click this folder in Windows Explorer and select the Security tab, add the ASPNET user (or on Win Server 2003 the IIS_WPG user) (In XP, if you don't see the Security Tab then google XP Simple File Sharing and you will find how to enable it). 

If you run into any difficulties post in the Developer forum and we'll try to help.

Tip: If you're interested in how to develop your own custom features for mojoPortal, look at the mojoPortal.Features.* projects and WebStore.* projects as examples where features are implemented separately from the core projects. I recommend you do the same, keep all your custom work in separate projects and don't make changes to the existing mojoPortal code. If you find yourself thinking you need to change something in the core, ask about it in the developer forum and we may be able to suggest a way to do it without changes in the core or we may be able to make changes in the core that make it easier to do what you are trying to do. The main point is you don't want to fork mojoPortal because then it will be very difficult for you to get upgrades as we are continually improving mojoPortal.

There are some video tutorials here that may also help:

Last Updated 2010-05-20

Rate this Content 9 Votes