Friday 26 January 2018

How to create custom file templates in Visual Studio

In my last post, I explained how to create a C project in Visual Studio. But can you also add new C files by clicking icons in the New Items dialog? Well, yes, you can – but you will have to create your own custom file templates first. This video shows how to do that…



When you’ve saved a template it is added to two directories beneath the \Users folder. For me these are:

C:\Users\Huw\Documents\Visual Studio 2017\My Exported Templates
C:\Users\Huw\Documents\Visual Studio 2017\Templates\ItemTemplates

I had a few problems when adding file item templates. Sometimes the newly added templates weren’t appearing in Visual Studio. I found that an easy way to fix this is to delete the template cache. That’s the entire \ItemTemplatesCache directory here:

C:\Users\Huw\AppData\Roaming\Microsoft\VisualStudio\15.0_d387180b\ItemTemplatesCache

Then I restarted Visual Studio and all my new templates appeared in the New Item dialog.

Tuesday 23 January 2018

How to create a C project in Visual Studio

Bizarre as it may seem, there is no option to create a C project in Visual Studio. You can create C++ projects by making a simple selection from the New Project dialog - but not C projects. Does that mean you can’t use Visual Studio to program in standard C? No, it just means that Microsoft, for reasons that I’ve never understood, has decided to ‘hide’ its C programming capabilities. In fact, if you want to use Visual Studio to program in C, it’s quite easy to do. This short video shows you how…