Setting up a CI server using Jenkins, MSBuild and GitHub on a Windows Server
When I was working for Medtelligent Inc. as a software developer a few months ago one of the things that really helped us to enhance the quality of the software we were building was presence of a good stack of project management tool, source control and continuous integration server for automated builds. That experience was good enough for me to bear in mind that I should try to use CI for every project that I’m responsible for. Recently I’d decided to setup a CI server for the company I’m currently work for as a project manager and since my experience with Hudson CI tool was good I decided to use this as well as GitHub as our source control server. It wasn’t completely straight forward to get it up and running but finally I could manage to get it working! Cause many of you may like to use my experience, I decided to share those tips I learnt during this job; so in this blog post I will try to demonstrate how to setup a CI server using Jenkins (a new fork of Hudson which is no longer active) and GitHub and MSBuild on a Windows Server.
First of all you need to download and install the latest version of Jenkins for Windows. Installing Jenkins on your Windows server wouldn’t be hard and will be done in a few minutes; just follow the steps provided in the installer and it will be installed on your machine easily.
Next step is installing required plugins inside Jenkins to interact with Git and GitHub. In order to do this select “Manage Jenkins” from the left side menu and then “Manage Plugins”; in the next page find Jenkins GIT Plugin and Jenkins MSBuild Plugin. Please note that you should have already installed Git on your Windows machine (if you don’t know how to do this read GitHub help) Don’t forget to restart Jenkins after installing these new plugins.
After installing those plugins you need to configure a few things:
- Copy .ssh folder and its content from your user folder (C:\Users\USERNAME\.ssh) into your Jenkins installation folder (typically C:\Program Files\Jenkins)
- Find Jenkins serice in your “Server Manager”, right click and choose Properties; then choose Log On tab and select “This account” and enter the Username and Password of the account you’ve logged in with and generated your public/private key:
- Restart Jenkins server by right clicking on its name and choosing “Restart”.
- Go to Manage Jenkins > Configure System and find Git section and set the values as shown below:
- Find MSBuild section and add required MSBuild installations and set the correct value to MSBuild.exe on your machine; you see the path for MSBuild for .NET Freamework 4.0 below:
- Go to SSH section and set the values for id_rsa key file as well as the private key available in that file as shown below:
I assume that you’ve already created required build scripts and put that inside a folder like “build” in your repository. The next step is creating a new job in Jenkins:
- Select “Create New Job”, enter a name for your job and select “Build a free-style software project:
- Click on Ok and go to the next step.
- Select Git as your Source Code Management and enter your Git repository address and branch name (leave the branch name field blank if you use master branch):
- Go to Build section and click on “Add build step” then choose Visual Studio option:
- Choose the MSBuild you created in Step 3 in configuration part and enter the relative path to your build script in your repository:
- Click on Save.
Now you’re ready to run your first build; if everything have been set correctly Jenkins will start to clone your repository from GitHub and then run your build script and if you have no error during the build process you will see the success message in Console Output of your current build: ![]()
The Most Useful Keyboard Shortcuts for .NET Developers
A few days ago I blogged about a .gitignore file for those developers with a focus on .NET technology and tools and today I want to share a small cheatsheet with you I called it “The Most Useful Keyboard Shortcuts for .NET Developers”.
You have probably seen many cheatsheets and blog posts talking about useful shortcuts to use in Windows, Visual Studio and etc.; Today I came up with an idea to create a single cheatsheet with the most useful shortcuts which a .NET developer can use in his/her daily coding stuff so I ended up creating a document containing some useful shortcuts for Windows 7, Visual Studio 2010 and ReSharper 6. You can view and download this document/cheatsheet on Google Docs.
Just like what I had requested for .gitignore file, please send me your suggestions as a comment on this post or to @mahdi on Twitter. This way I can complete/enhance this cheatsheet to be more useful.
A .gitignore File for .NET Developers
It’s a few weeks that I have started to move my projects over to Git. You’ve certainty heard a lot about this DVCS and its advantages and in this post I’m not gonna enter this area of pros and cons.
As I’m a .NET developer, working with Visual Studio and other related tools from Microsoft and other community companies I needed to customize .gitignore file to include some .NET-specified rules to prevent painful conflicts while working as a team. I found some resources on the community and tried to merge them all and create “A .gitignore File for .NET Developers” and shared it on Gist so that everyone else can grab it and add to his project controlled by Git.
You can view and download this .gitignore file here.
Also, I would be appreciated if you leave your suggestion as a comment so that I can complete the rules to cover more general cases.
EAV and the .NET Framework
Recently I've been working on a web application's database model in which I had different types of products and services that my client is going to offer in his eShop. The problem was different nature of attributes each type had and I should have defined a relationship between them and my online order pipleline. Using the common relational database approach I finished up with an OrderDetail table which had multiple foreign keys related to tables which was representing different kinds of products. Anyway, I'm not going to explain my project details here. That was a preface to explain a concept that Farid Arzpeyma introduced to me: Entity-Attribute-Value (EAV) Model, an approach that is widely used in enterprise eCommerce platforms like Magento.
There are many documents and articles out there describing EAV, its concept, principals and usages and I'm not going to talk about it here but quoting this which describes it shortly:
Entity-Attribute-Value model (EAV), also known as object-attribute-value model and open schema is a data model that is used in circumstances where the number of attributes (properties, parameters) that can be used to describe a thing (an "entity" or "object") is potentially vast, but the number that will actually apply to a given entity is relatively modest. In mathematics, this model is known as a sparse matrix.
What I came up with in my mind was possible existing frameworks for .NET developers to implement this model in their applications. Because EAV breaks the rule in which we're urged to use a vertical data representation (using columns) - by introducing another method of collecting data records and their types in table rows - it's necessary to adopt our OOP code to smoothly interact with this new structure. By the time Microsoft hadn't released SQL Server 2005, storing hierarchical data structures was a painful handy job for database developers but at the time Microsoft introduced XML datatype with SQL Server 2005 it became easier for them to natively store such structures right inside a column in a database. EAV is a similar concept and its main goal is to enable developers store attribute/value information in a table in a hierarchical manner.
Unfortunately it seems that there have been very few interests in the .NET community to work on open source frameworks in order to work with EAV database models. My searches shows a disappointing number of articles, blog posts and tools for this purpose.
The first article I found was Entity-Attribute-Value (EAV) model with SQL Server 2005 xml datatype that is talking about how to implement an EAV-like model using the new XML datatype in SQL Server 2005 and later. Mladen Prajdić has also referenced to another article explaining EAV in SQL Server more generally.
The second was a newer talking about a solution with Entity Framwork: Generic Entity Attribute Value Model – A POCO Implementation. This is closer to what I had in my mind because it's talking about EAV in general and how to implement our data layer, built on EAV pattern, using EF.
And finally the third was an open source project on CodePlex but unfortunately it seems that it's no longer active and there isn't even a public release out.
My conclusion is, the .NET community hasn't done much efforts on EAV concept and in my opinion it is because Microsoft policy - since creation of .NET Framework - has been just to spread this technology and best practices have rarely gone further on advanced and enterprise topics.
Microsoft Released Anti-XSS 3.0 Beta and CAT.NET CTP
Recently Microsoft released a beta edition of Anti-XSS library V3.0. Here’s a list of some new features which were added in this release:
- An expanded white list that supports more languages
- Performance improvements
- Performance data sheets (in the online help)
- Support for Shift_JIS encoding for mobile browsers
- A sample application
- Security Runtime Engine (SRE) HTTP module
Also as you can read on Microsoft Connected Information Security Group blog they have also released a CTP version of CAT.NET (Microsoft Code Analysis Tool .NET) which is a managed code static analysis tool for finding security vulnerabilities such as Cross Site Scripting - SQL Injection - Process Command Injection - File Canonicalization - Exception Information, etc.
Downloads:
