.Net AWS C# CI Github

3 Things I learned During Hacktoberfest

Hacktoberfest is a month long initiative to promote collaboration using Github. DigitalOcean created this event a few years back. This year I decided to participate in this event. In this post I want to share the 3 things I learned during Hacktoberfest.

Learn something new

During our busy schedules at work, we’re focused on maintaining existing products. In many occasions, these products are using old technology. We have a very small web site running ASP.NET MVC 2. MVC 2 was released on March 2010 so this web site is using old technology that is 7 years old. We tried to upgrade this website to run a more recent version but we ran into migration issues and the effort was abandoned. Since this site is not a critical product in our company, we decided not to spent more time on it.

With the recent release of .NET Core 2, it’s very important that .NET developers stay on top of these changes. Last month I created a new project in github called  DotNetDeployments. This project was created to automate .NET deployments. No more copy and paste files between servers. In order for me to learn something new, I decided to base this project on .NET Core 2. Core 2 was released on August 2017 and there are major changes in relationship to previous versions. In addition to learning .NET Core 2, I also learned DynamoDB high level operations using the AWS SDK.

Solve your own problems

Before Hacktoberfest took place, I started brainstorming ideas for a new project. I wrote down some ideas but I was not happy with those projects. I wanted to solve bigger problems. I’ve worked in different industries and companies and there is always areas to improve. In my current position, we are using Jenkins for our continuous integration server and powershell scripts to deploy our applications. With this setup, we are able to deploy 95% of our projects. The other 5% are deployed by copy and paste. It is not fun. So I decided to create a new project to solve this problem. DotNetDeployments will handle our deployments using AWS CodeDeploy and powershell will be use to create IIS sites, and create Windows Services. The beauty of this project is that it can handle on-premises servers and also AWS EC2 instances. Since this is an open source project, I’m expecting the community to get involved and make this project even better.

People are willing to help

After creating DotNetDeployments, I created github issues to keep track of all things I wanted to accomplish. I added “hacktoberfest” and “help wanted” labels to my issues so I can communicate with the community that I needed help. It didn’t take long and I was receiving small pull requests. I was so excited that developers were willing to help a new project. I reviewed the code and was able to accept those pull requests. After the first pull requests, I decided to add AppVeyor to handle my automated builds. AppVeyor is really easy to use and their documentation is awesome. Now with CI in place, I created more issues to handle unit tests, and also to rearrange the folder structure. I received more pull requests and was happy to review and accept them. Some of these changes broke the build but I merged those changes since I had a different issue to update AppVeyor config file. These changes were necessary because our folder structure changed. I just want to thank all the contributors that are taking the time to make this project better. We’re not done yet but during Hacktoberfest we made a lot of progress.

In summary, Hacktoberfest was a very successful initiative by DigitalOcean and GitHub. During this month, I was able to learn new technologies and solve real problems that developers face every day. DotNetDeployments could not be possible without the help of the community. Thanks to all contributors.



.Net C# Visual Studio

Read error messages

My friend, Bruce, was having issues building a software project. He tried different things to solve it but did not succeed. He spent hours with this problem. Since I was watching a soccer match, I didn’t take time to help him.

After the game was over, I took 5 minutes out of my busy schedule to see what the issue was.

He had a .Net solution that contained 12 projects and 1 of those projects refused to build. This project was a base project where other projects depended on to build the entire solution.

First, we tried to clean the solution but still refused to cooperate. Next, I asked Bruce to show me the subversion pending changes. He had a lot of pending changes but they were simple classes.

After that, we tried to build individual projects until we narrowed it down to 1 project. We knew that it failed to build but we did not see the actual error message.

I asked Bruce to display the output window and read the error message. The error message said, “unable to build project since it references another project with a higher .Net framework version.” Most of the projects in the solution were using version 4.0. Finally, we knew what the problem was. He updated all projects to use .Net framework version 4.5.2 to match the version of the library.

Build succedded.

After spending time with this issue, I came to the conclusion that reading the actual error message will eventually help you solve it.

.Net C# Github

Building a game engine with .NET Core


Now that we have .NET Core available, it is time to get our hands dirty.  I had the opportunity to setup Visual Studio Code along with the .NET Core SDK on Windows 8 and Mac OS Sierra.

What a better way to learn Core, than building a game. For this fun project, I decided to build a version of Blackjack using C#, Visual Studio Code, xUnit, and of course .NET Core.

The project is hosted at GitHub and some of the main goals for this project are:

– cross-platform (must run on windows, mac, and linux)
– unit tests are required
– all tools and processes used must be open source

I created issues to start this project in the right path. The main classes for this game should be Card, Player, Deck, and Game.

Based on, the rules of the games are:
– each participant attempts to beat the dealer by getting a count as close to 21 as possible, without going over 21.
– it is up to each individual player if an ace is worth 1 or 11. Face cards are 10 and any other card is its pip value.
– if a player goes over 21, he/she loses

For this project, I’m going to use bicycle cards as a guide for the requirements since there are many rules for this game.

I hope that you join me in learning .NET Core and at the same time have fun playing 21.



ASP.NET MVC C# ruby ruby on rails

How Ruby on Rails Taught me ASP.NET MVC

Before learning ASP.NET MVC, I had the opportunity to learn Ruby and Ruby on Rails. In this post I want to share how Ruby on Rails taught me ASP.NET MVC.

Managing Dependencies

To create a ruby on rails app, let’s type “rails new blog” in a terminal or command prompt. Now that we have a new app, we can see how rails manages dependencies. By running command “bundle install” inside the blog directory, Bundler will install all dependencies inside the Gemfile. It is that simple.

ASP.NET MVC has a similar process. We use nuget to install and manage dependencies. And our Gemfile is named packages.config. We also have a command line to install libraries (Install-Package jQuery).

App Structure

By convention, rails app creates the following directories inside the root app directory:  models, views, and controllers. ASP.NET also creates models, views, and controller but they are created at the root level. Rails gave me a solid understanding on the MVC architectural pattern. Before learning ASP.NET MVC, I knew that models were responsible for the domain’s entities. Views are only concerned with the presentation layer (UI). And controllers manage incoming requests and provide a link between models and views.


Before learning rails, I was using ASP.NET Forms. With this framework, we were not concern with routing because aspx files were served directly from the file system. There was no configuration done by us. The system just handle it. In the rails world, the route config is located in config/routes.rb. A typical route file might look like:

get "/posts" => "posts#index"
get "/posts/:id" => "posts#show"
get "/posts/new" => "posts#new"
post "/posts" => "posts#create"  # usually a submitted form
get "/posts/:id/edit" => "posts#edit"
put "/posts/:id" => "posts#update" # usually a submitted form
delete "/posts/:id" => "posts#destroy"

In ASP.NET MVC, you will see:

public class MvcApplication : System.Web.HttpApplication
    public static void RegisterRoutes(RouteCollection routes)

            "Default",                                              // Route name 
            "{controller}/{action}/{id}",                           // URL with parameters 
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults


    protected void Application_Start()

They are basically mapping a request to a controller action. After learning rails, it was very easy to me to pickup this new routing thing.

I’m always recommending that you learn a new programming language, framework, or tools. In my case, I decided to learn a new web framework called Ruby on Rails. Not only I learned a new programming language but also a new web framework. I never anticipated that by learning rails I was also gaining a solid foundation to learn and use ASP.NET MVC.

ASP.NET C# General

Getting started with RazorEngine

razor engine

RazorEngine is an open source templating engine based on Microsoft’s parsing engine. You can use Razor syntax to build dynamic templates. In a project that I’m working on, I’m using it to build an email based on data retrieved from different sources. Let me show you how to start using RazorEngine in your project.

Create a new console application using visual studio. Now install RazorEngine using nuget (Install-Package RazorEngine). After installing RazorEngine, you will see 2 packages in your packages.config, Microsoft.AspNet.Razor and RazorEngine.

Now create a strongly typed view.


Make sure you save the file as a c# view (extension .chtml). As you can see from the above image, we are using the ConsumableData model which will hold the data for us.

With the template in place, we can add code in our Program.cs file to gather our ConsumableData by setting CustomerName to Raymond.

var data = new ConsumableData { CustomerName = “Raymond” };

With our data in place, it is time to use RazorEngine and compile our template.

var template = File.ReadAllText(“pathToTemplate”);
var email = RazorEngine.Engine.Razor.RunCompile(template, “templateKey”, typeof(ConsumableData), data, null);

After calling RazorEngine’s RunCompile method, we will have our email ready to be send.

As you can see, you can use RazorEngine to build dynamic templates. If you have used Asp.Net Mvc before, the above code should be familiar to you.

Take it for a spin and let me know what you think.

ASP.NET C# code General Git Tips

Show me your progress with your commits

Git Commit

I’m currently working in a new application. It’s an ASP.NET MVC site written with C#. We are using the following technologies: Windows Communication Foundation, Knockout, Bootstrap, PostgreSQL, and Git.

I’m working on a new feature that will require me to make changes to the UI, javascript files, add new database tables, add service methods, add unit and integration tests. In other words, I have to modify all layers in our application.

To accomplish this task, I decided to try something different. I want to show my progress with my git commits. I want to complete small tasks and then commit my changes. For this specific task, I started writing a falling integration test. This failing test forced me to create the new database tables needed. After creating the tables, I ran the tests again and this time everything was back to green. At this point, I’m ready to commit these changes. This commit is the beginning of my work and it gets me closest to the final goal. I go ahead and commit this change.


After adding the database tables, sql scripts to generate them, and some unit tests, I’m ready to start adding service methods, data contracts, etc. For this task, I follow the same technique as above. My unit tests pass and I have not broken the build so it is time for another commit. With this second commit, I’m feeling productive. I have accomplished something. I can show my progress to my boss or team members with these small commits.

On the other hand, working for a long time without committing your changes, makes me nervous. What would happen if your hard drive fails? It happens all the time. I think we all have experienced losing our work. Many times it was something other than a hardware failure. It was a human error. For example, we deleted some files that were not in source control by mistake.

That’s why I like to commit often. As long as my project builds and my unit tests pass, I’m going to commit my small changes. I know that these commits don’t fulfill a complete feature, but they take me a step closer to my finish line.

After a few commits, I have accomplished enough back-end code that I can concentrate on the UI. Here is the initial version of the UI:


It is not perfect. I know that changes are inevitable. I would say that right now I have completed 80% of the task needed to bring this work to completion. I have 20% more to go and I can see the finish line. Seeing the finish line motivates me to do my best and finish strong.

I urge developers to commit small changes and commit often. Remember that these small changes will help you accomplish your goals sooner rather than later.

.Net ASP.NET C# open source Xamarin

All you need is C# to conquer the world

csharp c#

C# is an object-oriented programming language created by Microsoft. Wikipedia describes the language as “simple, modern, general-purpose, object-oriented programming language.” With the language, you can create many types of applications, web sites, desktop applications, mobile applications, web services, and many more.

If you know C#, then you can conquer the world. Yes, you read it correctly. You can conquer the world of software development with your knowledge of this programming language. You are only restricted by your imagination.

Here are the 3 reasons why I think C# is the number one programing language to conquer the world: mobile development, web applications, and open source initiatives.

Mobile Development

No one can deny that mobile applications are dominating our time and resources. Recent studies have found that the average user spends more time browsing thru mobile devices compared with desktop browsers. With these demand of mobile applications, businesses are pressured to keep up with this trend. Now they need to provide apps for the two major mobile ecosystems, Apple  and Google.

There are many choices to develop mobile applications, native, HTML, and C# with Xamarin. Nat Friedman and Miguel de Icaza created Xamarin to solve the problem of dealing with different code bases. If you want to write native applications for Android, you will have to write it in Java. If you want to write native applications for iOS, you will have to write it in objective-c. With Xamarin, you are able to share code across iOS, Android and Windows platform.

With your knowledge of C#, you write code once and Xamarin compiles your code for the intended platform.

Web Applications

There are many web sites developed to run under the .Net Framework. These sites still need to be managed and enhanced. Businesses have invested millions of dollars in their sites and there is a need to keep these sites working correctly. If you know C# with experience in the ASP.NET web application framework, I assured you that there will be enough jobs for the years to come.

So who is using this framework? Some of the companies using ASP.NET are: US Airways, Bing, Msnbc, Kelley Blue Book, 3M and many others.

Open Source Initiatives

In November 2014, Microsoft announced in New York that many components that are part of the .NET framework are released in github as open source. See Scott Hanselman’s blog for a complete listing of projects and initiatives taken by Microsoft to make ASP.NET 5 cross platform. Along with these changes, Visual Studio Community is now available for students and open source developers. There is also a new .NET Core CLR for Linux, Mac, and Linux. If you want to see the changes, go to the github dotnet page. I believe these changes by Microsoft allows for more innovation. And with innovation, we will see new products and also improvement to the existing .NET framework.


I believe C# is an excellent programming language to conquere the world of software development. There are sites developed in the ASP.NET web framework that still need maintenance and enhancement. With the recent rise of mobile development, your C# skills will allow you to write cross-platform apps with Xamarin. The open source movement by Microsoft has taken a major change for C# developers. It will allow you to write cross platform on any OS.


Book giveaway – Professional ASP.NET 2.0 Security, Membership, and Role Management

Pro ASP.NET 2.0 Security

I’m giving away a book written by Stefan Schackow titled Professional ASP.NET 2.0 Security, Membership, and Role Management.  I no longer used this book and want to help other software developers using ASP.NET 2.0. To have a chance to win this book, write a comment below stating how you are helping others. Let me know how you are helping the next generation of software developers / engineers. You probably speak at conferences or teach programming in your community.

This offer is only available to people that live in the United States. I will choose a winner on Christmas day.