English
Français

Blog of Denis VOITURON

for a better .NET world

Visual Studio - Add a new file

Posted on 2022-02-17

Unlike VSCode, Visual Studio does not have a keyboard shortcut to quickly add a file in the Solution Explorer.

To resolve this issue, Mads Kristensen created the extension Add New File (64-bit).

This extension for Visual Studio makes it easy to add new files to any project. Just press Shift+F2 to create an empty file in the selected folder or in the same folder as the selected file.

The content of the file is based on his extension that you want to create. It is possible to customize the content of this file, using a .templates folder.

For example, add the file .cs.txt to the .templates folder of your solution. This template will automatically be used when you create a CSharp class.

// ------------------------------------------------
// Copyright (c) MyCompany.  All rights reserved.
// ------------------------------------------------

namespace {namespace}
{
    using System;

    /// <summary />
    public class {itemname}
    {

    }
}

Note: you can also create this template in the global folder of the extension. C:\Users\<User>\AppData\Local\Microsoft\VisualStudio\<Version>\Extensions\<Extension_ID>\Templates

Languages

EnglishEnglish
FrenchFrançais

Follow me

Recent posts