How to 'Git' ASP.NET Web Stack

Recently Microsoft went Apache 2.0 with large chunks of the ASP.NET Web Framework. Just before that, they introduced Git support on Codeplex. Now it doesn’t seem so co-incidental.

Git, if you didn’t know is a Distributed Version Control System (DVCS), and has been the OSS world’s darling since it got introduced. GitHub, the premier source control site for OSS projects having overtaken Sourceforge.net some time last year. Microsoft’s big foray into OSS also wanted to highlight the acceptance of Git’s popularity. Hence the ASP.NET Web Framework was released on a Git Repository at CodePlex.

I have been on the fence for a while about Git because my perception, the tools for Git were not there yet. But today I decided to bite the bullet and do what it takes to get ASP.NET Web Framework. The project is at http://aspnetwebstack.codeplex.com/ and right on the home page is the link to get a nice little application that will solve most of your git pains. So like me, if you have been waiting on the fence regarding Git, follow along and enter the world of Git.

asp-net-web-stack-home

Installing Git for Windows

The above link takes us to code www.git-scm.com. The download link is on the right. Click on the Windows version to get to the following page. Download the highlighted exe and initiate the install.

git-setup-download-page

Continue with the wizard till you reach the following page

select-git-bash-UI-git-setup

You have to select one of two highlighted items below. Bash gives you a command shell to work with Git, whereas GUI gives a small GUI to use Git repos.

Continue installation till you reach the following screen

adjust-path-git-setup

Select ‘Run Git from the Windows Command Prompt’, this enables you to run Git from the normal Windows Command shell in addition to the BASH shell being installed.

In the next step, keep the default option

line-ending-config-git-setup

In Windows, a line break is represented by a Carriage Return (CR) followed by Line Feed (LF), however in the *NIX world it’s just Line Feed. This option handles this discrepancy for you, so that if your code was used on a *NIX machine, the linefeeds wouldn’t get messed.

Cloning Repositories using GUI, Bash and Command Shells

Once the installation is finished, launch the Git GUI

home-git-gui

Click on Clone Existing Repository

clone-git-gui

In the Source Location, provide the following URL (https://git01.codeplex.com/aspnetwebstack.git no need to say Git clone)

git-repo-location-url

- In the Target provide a folder where you will be saving all your Git repositories. Provide a folder name in the end that does not exist yet

- Click ‘Clone’ and wait for the download to complete. Once it completes, you will see a screen similar to the following

git-clone-complete-ui

What this means is the pull is complete and there are no changes at the moment. If you make changes they will get reflected here.

My folder structure is as follows:

image

We could have done the same thing using the BASH shell by typing the following command in the BASH Shell. ‘aspnetwebstk’ is the target folder into which the source will be pulled.

git-clone-bash

On the Command prompt too, the following command would pull the repository

git-clone-cmd

Building the Solution

Open Command prompt and navigate to this folder. Run the command

build RestorePackages


What this command does is it looks up all the nuget dependencies and downloads them as required. This step takes a few minutes and you should see a result as below

restore-nuget-packages-cmd-line

Before we complete the build from the command line, there are two caveats

1. If you have ASP.NET MVC4 Beta installed, the code compilation will succeed but the tests will fail because of a failed unit tests. xUnit refers to the latest MVC framework and flags a bunch of methods as ‘not implemented’. Building from Visual Studio does not have this issue.

2. Assuming you are running latest non-beta .NET framework, you have to download ‘SkipStrongNames’ and unzip it. Then start a command prompt with elevated privileges (Right click on short cut and select ‘Run as Administrator’). Run “skipstrongnames –e” in the folder where you extracted the SkipStrongNames zip file. You will see a bunch of registry entries getting modified.

Now do the complete build using the following command

build

If you don’t want to do all the above, just fire up Visual Studio 2010 (I always do with elevated privileges) and open the Runtime.sln.

Build and rejoice! You now have asp.net web framework building right off your machine!!!

Next up, find something to add value and contribute back to the project!





2 comments:

Anonymous said...

awesome, i just need a decent gui git client. Any recos?

Anonymous said...

yes try http://code.google.com/p/gitextensions/