Visual Studio Toolbox
15 Visual Studio Project Templates To Jump Start Your Code
Next time you're starting a new development project, skip the tedious configuration and setup with these handy templates.
- By Terrence Dorsey
In this space, I typically write about tools that help you build, manage, test or deploy software development projects. The one part of the project I've mostly ignored thus far is perhaps the most important: Getting started.
New work typically starts with an idea, then File | New | Project. Then what? Most IDEs, Visual Studio included, provide some basic project templates that include commonly used files, folders, libraries, and so on for various development tasks or targets. But if your needs lie beyond the boundaries of those few supported project scenarios, your next task is likely to involve some (and possibly a lot of ...) dull configuration and scaffolding work before you type the first line of code.
Fortunately, enterprising folks in the development community created Visual Studio templates specially tuned for a staggering number of project types, target platforms, development stacks, and software frameworks. Here's a look at a few of them.
The most basic scenario is creating a bare-bones project with no added packages, but it turns out that the "Blank App" template in Visual Studio 2015 isn't really blank after all. By default, it includes a number of NuGet packages you might not want in a simple project.
Weston Thayer thought this was weird, so he created a Truely Blank App template that has most of the NuGet packages removed and turns off the frame rate counter as well. You can read more about what Thayer is doing over at his blog Cryclops | sad cyclops.
Speaking of NuGet, Ove Andersen has written a NuGet Packager template that greatly simplifies the process of setting up, packaging, building and publishing NuGet projects.
Anderson's template follows the "Creating and Publishing a Package" standard conventions in the NuGet documentation and just takes the dirty work out of the process. It supports Visual Studio 2013, 2012, and 2010. Visual Studio 2015 support has been added, too, but wasn't in the project description when this article was posted.
Windows Internet of Things
Something I missed until looking these templates up: Microsoft is creating an Internet of Things (IoT) platform alongside Windows 10 and Microsoft Azure. Windows 10 IoT: Powering the Internet of Things explains some of the strategy here, including a version of Windows 10 for small devices!
For further information, including documentation and sample projects, check out the Windows IoT Dev Center and the IoT videos on Channel 9.
Apache Cordova Template for Windows 10 is a project by Microsoft's Kirupa Chinnathambi that takes advantage of new Apache Cordova features to create Visual Studio 2015 projects that target Windows 10 in addition to Android and iOS. To learn more about this new option for Windows app development see "Introducing the Windows 10 Apache Cordova Platform" on the Visual Studio Blog and "What's New in Windows 10 for Cordova" over on GitHub.
For more typical mobile application Cordova projects targeting Android, iOS, and Windows Phone, take a look at the Cordova Multiplatform Template, which uses Gulp/Node, Ionic/Angular, SASS, and TypeScript. The template was created by Quique Fdez Guerra. You can learn more, find documentation, and play with a demo at the Cordova Multiplatform Template Web site and learn more on the CKGrafico blog (¡En español!).
Like using Caliburn.Micro as the base framework for your XAML MVC/MVVM applications? Bogdan Bujdea created a simple Caliburn.Micro Windows 10 Template for Visual Studio 2015. Now you don't have to waste any time installing Caliburn.Micro for a new project. Just open the template and start coding.
Cool backstory here: Just getting started with developing for Windows 10, Bujdea was inspired by other community contributions that helped him learn. So he decided to create the Caliburn.Micro Windows 10 Template and share it right back. High five! Read the story over on Bujdea's blog.
SOLID Enterprise Apps
If you're starting a new project and want to get it organized right from the start, take a look at Alexander Viken's Enterprise Application SOLID Solution template, which sets up a boilerplate solution containing five projects in solution folders based on the SOLID principles. By default it sets up Documentation, Presentation, Business, Domain, Data, Cross-Cutting, and Deployment layer folders for your solution, and pre-configures the Business, Domain, Data, and Cross-Cutting layers with boilerplate code and test projects.
If you're not familiar with the SOLID principles for object-oriented programming, definitely read Uncle Bob's original "PrinciplesOfOOD" article, as well as Samuel Oloruntoba's "S.O.L.I.D: The First 5 Principles of Object Oriented Design" (with handy code examples) and William Durand's "From STUPID to SOLID Code!"
Data-Driven Dynamic MVC
Here's an interesting idea for building data-centric Web applications: Chis Perry's Dynamic MVC template (also available as the Dynamic MVC NuGet package) lets you dynamically create Controller methods and routes based on metadata from your Model objects. Perry has a series of project-based tutorials on the Dynamic MVC Web site showing you how it works. I see a lot of potential for bad data-myopic implementation here, but also a lot of potential for building data-smart apps if used wisely.
Let's start out with Aby Mathew's ASPNET MVC ANGULAR Project Template, which is configured up front with ASP.NET MVC 5.0, Angular, and Web API 2.0, along with Bootstrap and Angular's ng-grid Data Grid (soon to be known as UI Grid).
Muhammad Rehan Saeed put together a very comprehensive ASP.NET MVC Boilerplate template based on Microsoft's default ASP.NET MVC template, but with a greater emphasis on security, performance, search engine optimization (SEO) and social media integration, accessibility, and browser compatibility, among other features, right out of the box. A key, unique feature added by Saeed: "liberal use of comments and even gives you a checklist of tasks which you need to perform to make it even better."
The AngularJS SPA Template, by Konstantin Tarkus, is a port of the Angular Seed project optimized for creating single-page Web application (SPA) projects in Visual Studio. It includes AngularJS, Bootstrap 3, HTML5 Boilerplate, Razor, and the ASP.NET Web Optimization Framework. This looks like a really well thought out starting point for SPA apps.
Definitely also take a look at the SPA posts by John Papa for a deeper look into the theory and practice of building SPA apps with Angular.
Pieter van der Westhuizen, author of "Bootstrap for ASP.NET MVC" (PACKT Books 2014), put together the Bootstrap Bundle package of the Bootstrap project and item templates for Visual Studio. It includes all of the example layouts and Start Bootstrap's Modern Business and Business Casual full Web site templates optimized for ASP.NET MVC development. More information and a support forum are available at the ASP.Net MVC Bootstrap Bundle Web site.
Web Services and Clients
ASP.NET Web API is a great framework for quickly building robust Web services and RESTful APIs. Guess what? There are handy templates to get you started.
Houssem Dellai has been busy writing not one, but two of them, a Windows Store Http Client project template and a Windows Phone Http Client template. Both aim to get you started quickly building apps that can consume Web API Web services.
Of course, you'll need an API for those clients to consume and Nikos Baxevanis has an Empty ASP.NET Web API Project Template to get you started. It's based on Phil Haack's Really Empty MVC 3 Project Template, which he explains in the blog post, "Creating a Custom ASP.NET MVC Project Template."
What Are Your Favorites?
That's just the tip of the iceberg when it comes to Visual Studio templates, and I tried to make sure they all support at least Visual Studio 2013 and, wherever possible, Visual Studio 2015 RC as well.
Which project templates are you using most often, or find particularly well-tuned and kept up-to-date? Share your suggestions in the comments for this column and we'll use your recommendations as the "template" for a future article.
About the Author
Terrence Dorsey is a technical writer, editor and content strategist specializing in technology and software development. Over the last 25-plus years he has worked on developer-focused projects at ESPN, The Code Project, and Microsoft. Read his blog at http://terrencedorsey.com or follow @tpdorsey on Twitter.