What are the most popular libraries C# developers use? Based on the top GitHub repositories
After a few years of focusing solely on Java developers, we’ve decided to broaden our horizons and explore a whole new language. This year, we’re using our data crunch skills to explore what popular libraries are being used by C# developers. Who will sit on the C# throne?
Follow us on Twitter for all the latest and greatest posts from our blog:
— OverOps (@overopshq) August 29, 2018
The Top C# Libraries
The top C# library of 2018 is… Newtonsoft! Or as most developers know it: Json.NET. As the name implies, it’s an open source JSON framework for .NET. It allows converting between .NET objects and JSON, it can convert JSON to and from XML, and more.
The list continues with Orchard at number 2, and BetterCms at number 3. Both libraries offer content management systems (CMS) platforms for C#, with the former focusing on the community and the latter on developers.
NUnit comes in number 4, and according to its position we can understand that this unit test framework for .NET is pretty popular among developers. And closing our top 5 C# libraries for 2018 is ReSharper, by JetBrains. This library is an extension for Visual Studio which allows .NET developers to do on-the-fly code analysis and eliminate errors.
Significant Trends Among the Top 20 C# Libraries
When we take a broader look at the top 20 C# libraries on GitHub, we can identify some clear trends among them. The first trend is familiar to every developer, regardless of the language they write in – testing and debugging the application.
The first one is Xunit, which we can find at #6 on our chart. It’s a free, open source, community-focused unit testing tool for the .NET Framework. Closing the top 10 popular libraries is dnSpy, a debugger and .NET assembly editor. You can use it to edit and debug assemblies even if you don’t have any source code available.
Cake, at number 11, is a cross-platform build automation system for tasks such as compiling code. The last from the debugging trend in our top 20 libraries is log4net; a tool that helps output log statements to output targets. On the practical side, it allows developers to log messages according to message type and level, and to control at runtime how these messages are formatted and where they are reported.
Another trend we can detect is the use of CMS platforms. Orchard and BetterCms got into the top 5 C# libraries, and we can see two other popular systems in our top 20 libraries count. The first one is umbraco, an open source Microsoft ASP.NET CMS, and the second one is DotNetNuke, which was renamed in 2013 to DNN Corporation, and was acquired in 2017.
What Else Do We Have Here?
Within the top 100 C# libraries we were able to spot some interesting finds, such as:
#27 – Xamarin – A Microsoft-owned company that offers tools to write native Android, iOS, and Windows apps with native user interfaces and share code across multiple platforms.
#35 – Rubberduck – Component Object Model add-in that integrates with the Visual Basic Editor to enable the features of an IDE, such as unit testing, source control, code inspections, refactorings and more.
#38 – Cosmos – The C# Open Source Managed Operating System is a toolkit for building operating systems.
#59 – MonoTouch – A .NET Development platform for iPhone, known as Mono and is operated by Xamarin.
#93 – NBitcoin – A bitcoin library for .NET, which implements relevant Bitcoin Improvement Proposals (BIPs).
#100 – SixLabors – A Cross platform graphics processing libraries that run on .NET Core, which includes ImageSharp, Fonts and Shapes.
See the full list of top 100 C# libraries, here.
Pulling the Data From GitHub
For the final list of libraries, we turned to Guy Castel (👑) from OverOps R&D team, who used Google BigQuery to pull and crunch the data from GitHub. First, we’ve used GitHub’s API to pull the top 1,000 repositories, and extracted the C# libraries these repos use.
After filtering out deprecated repos and removing duplicate uses of the same library in the same repo, we ended up with 21,901 unique libraries. Then, we filtered out System/Microsoft/Windows standard libraries, which left us with 18,471 libraries.
How did we do it? We added some SQL query. First, we wanted to create the top repositories table, called cs_top_1000_repos_filtered:
Now that we had the names of the top repositories, we pulled all of their content:
After we had the source files for each project, we wanted to pull all of their unique import statements. In the following query, we extract the package name, and made sure it is counted just once per project:
The final step was filtering the results again, making sure that there’s no deprecated or standard C# libraries that might have slipped through our query-cracks:
And there you have it, the top C# libraries of 2018.
Will Microsoft’s Acquisition Change Anything?
On June 2018, Microsoft announced the acquisition of GitHub, for the shocking sum of $7.5 billion in Microsoft stock. The developer community didn’t seem too happy about this action, especially due to GitHub holding most of the market share of open source projects.
In their official press release, GitHub promised that it will “retain its developer-first ethos and will operate independently to provide an open platform for all developers in all industries”. However, you could see on various websites and social media platforms that developers are threatening to move to a different tool. But, will they?
Luckily, we have some answers. GitLab, one of GitHub’s main competitors, and the tool that was able to shine thanks to this acquisition, is giving us the numbers. On their Grafana monitoring dashboard we can see the number of projects that have been imported since the announcement until mid-July:
And the number of projects that have been imported from GitHub during the last month:
As we can see, while there was a peak at first, the numbers are slowly declining. And it’s not surprising; while independent developers have the option to “pack their bags and leave”, it’s a much harder task for organizations and companies who have already established their workflow.
Using a new tool comes with onboarding for the entire team, a change in how things are done and of course, the tedious task of moving everything from one place to another. It’s not impossible, but there has to be a good reason for companies to make the move to a different tool.
Microsoft’s approach has changed during the past few years towards a more developer-friendly environment, and as it seems right now, GitHub is not going to change drastically.
In other words, if you’re comfortable with GitHub, you should stick to what you know and love. If you were already looking for an excuse to change things up, now might be a good time to make a move towards a different platform.