Even though Visual Studio Express is a free product, you can still create professional projects with it. But it does have few limitations. One of the features missing is Source Control System. Even if you are coding only by yourself, it really comes handy to have an ability to return to previous versions of your project in case you mess something up. You could also use it as a version control to track history of your project.
But luckily you can still use Source Control even if it is not integrated in VS Express.
I looked around at various revision control and source code management systems available for Windows and decided on using Git.
First I tried to install Git Source Control Provider but this is a git plugin for Visual Studio and Express Edition does not support plugins.
So with no help from plug-in my focus turned on separate git clients with graphical user interface.
Next I tried Git Extensions. This worked but it still seemed little too complicated for me.
And then I discovered one that is really good and simple to use.
GitHub for Windows
Rest of this post explains how to install GitHub for Windows for VS Express. But you can also use it for other things too, for example in web design.
The five steps are as follows:
- First download and Install GitHub for Windows. You can use your project locally or you can use GitHub hosting service where public repositories are free, but private repositories cost few dollars per month. if you want to keep your code private and do not want to spend money, then go local. This is how I work, so the next steps describe working with GitHub for Windows as a local client.
Note:If you do not want to work locally but also prefer to stay private you could also probably use some other hosting services that support free private repositories but I never tried them myself.
- Run the application. Next we need to configure git. So choose local and click on tools > options
Under configure git you have to provide your name and your email.
Git will use that to identify you. This information will also get embedded in commit logs. So if you decide to share your repository with others, they will see this information. You do not have to use real email though.
you can also set other things like:
- choose default storage directory where your repositories will be stored
- you can select default command shells for git. You need to use command shells only if you need to do more advanced work with git.
- Sign up / Log in to GitHub Service. If you will only use github locally, leave connect to github fields empty.
- Create a new repository for your .NET project by clicking +add button which is located left of tools. Give it a name and click create.
- Now we need to update .gitignore file. Click on the newly created repository and then go to tools > settings
Under ignored files (.gitignore) is a list of files and directories that git should ignore and not track their changes.
To have language specific ignore list go to https://github.com/github/gitignore and click on the language you are working on. If for example you are working in C#, click on CSharp.gitignore.
Copy the whole text and paste it in ignored files window and click update.
- Now copy solution folder and .sln file (no need to copy .suo file) into the repository.
There you will find .gitignore and .gitattributes files and hidden .git folder. GitHub for Windows will automatically detect the files and will show you that there are uncommitted changes as shown below:
When working on the project in Visual Studio Express, GitHub for Windows will detect all the changes and give you list of changed files on the left side of window. You can click on a single file and if it is not binary file it will even show you changes that were made for that file.
When you are ready to commit, just give it a name and click commit.
And this is how you can have source control with Visual Studio Express.
I never worked with Visual Studio paid editions, so I am not sure how source control works when you have it integrated in IDE but so far using source control like this seems just fine.
if you find this article useful, please drop a comment or consider sharing either the article or the blog using the social icons.