Cricket.Net: Part 1 – Setting up the initial project

Summary
Cricket.Net is a new open source project that I’ve started on Codeplex. It will be a web application that will be used for tracking software bugs. Cricket.Net will be written in C# using HTML5, ASP.NET MVC 3, Entity Framework 4.1 Code First, StructureMap, and the Onion Architecture. This project will be an example application to demonstrate how to use these technologies together to build a web application from the ground up.

I’ll also be going through using Mercurial both on my system and pushing changes to the Codeplex site.

Cricket.Net Series:

Prerequisites
To get started, I’ll be using Visual Studio 2010 SP1Rel and ASP.NET MVC 3 Tools Update. Later, I’ll be using Entity Framework 4.1 Update 1 so that I can use Code First. You can either download and install Entity Framework, or we’ll attempt to install this from the Nuget package first.

Creating A New Project
Initially, I’m going to start with the basic MVC package created by Visual Studio. After this package is created, I’m going to create the Mercurial repository so that I can send the code to Codeplex.

  1. Open Visual Studio 2010.
  2. Click the File menu, then New, Project.
  3. In the New Project window, under Installed Templates, expand Visual C# and choose Web. Select the template called “ASP.NET MVC 3 Web Application.” The Name field will be the default name and namespace of your initial project, the Location will be the folder on your C:\ drive where to store your solution, and the Solution Name is the name of your solution folder (if you wish it to be different).
  4. After clicking OK, the New ASP.NET MVC 3 Project window pops up. I’m going to choose Internet Application so that the tooling will allow me to go ahead and create a Unit Test project also. I’m going to change the name of the Unit Test project to Cricket.UnitTests.
  5. After Visual Studio finishes creating the project, it should look like the image below. The Internet Application template that we had chosen in the previous step has added some files that will may or may not use, but for now we’ll leave these in the solution and move on to creating the Mercurial repository.

Setting up the Mercurial Repository
If you are unfamiliar with Mercurial, it is a source control application that is very fast and pretty easy to use. Before you can continue with this tutorial, you will need to install at least TortoiseHg to manage the Mercurial repository from Windows Explorer.  If you’d also like to work with it from within Visual Studio, you will need VisualHg.  If you’d like to know more about what Mercurial can do, check out this video from tekpub.com.

  1. If you still have your new solution open in Visual Studio, go to the File menu and choose Close Solution.
  2. Next, browse to the folder where your solution folder is located. (In my case, I need to go to the C:\Users\cjackson\Documents\All Projects\ folder)
  3. Right-click on the Cricket.Net folder and expand the TortoiseHg context menu and choose Create Repository Here.
  4. TortoiseHg will display an Init window. Click the Create button to create the repository.
  5. After the repository has been created, a green check mark icon will appear over the Cricket.Net folder icon.
  6. Open the Cricket.Net folder and then edit the .hgignore file. This file will tell the repository to ignore certain files/folders that are used by Visual Studio and do not need to be version controlled. Paste the text below into the file and save it.
# use glob syntax
syntax: glob

*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]humbs.db
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.resharper

Next, I’ll save the initial project into the Mercurial repository.

  1. Return to the folder where your solution is stored. (C:\Users\cjackson\Documents\All Projects\ folder)
  2. Right-click on the Cricket.Net folder and choose Hg Commit…
  3. The Cricket.Net commit window will pop up. On the left pane, click the check box at the top to select all files then in the top-right pane, type in a comment for the commit. After you enter whatever comments you wish, click the Commit button to save the current state of the solution.
  4. Next, for new untracked files, a window may pop up asking to add untracked files. Click Add.

To save the current repository to Codeplex, follow these instructions:

  1. Return to the folder where your solution is stored. (C:\Users\cjackson\Documents\All Projects\ folder)
  2. Right-click on Cricket.Net and expand the TortoiseHG context menu and choose Synchronize.
  3. Under Remote Repository, change the drop down to HTTPS and enter the name of the repository so the URL looks like this (http://hg01.codeplex.com/cricket)
  4. Click on the  icon to push changes to Codeplex.
  5. Enter your Codeplex username and password when prompted and the files will be uploaded to Codeplex.

Visit the project site at: http://cricket.codeplex.com.
Download the source code from this post at: http://cricket.codeplex.com/SourceControl/changeset/changes/1569d75e695b#

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *