December 20th, 2022

Adding new files just got a lot faster

Josh Stevens
Senior Software Engineer

Have you ever felt like the New Item Dialog slows you down when you want to quickly create an empty file or a simple C# class? Browsing through a list of templates is sometimes necessary, but wouldn’t it be great if Visual Studio could figure out which template you needed based only on the file name?

If you answered yes, then you’ll want to use the new Quick Add Dialog! To get started being more productive with less clicking, download the latest preview version of Visual Studio:

Try out the Quick Add experience

Once you have the latest preview, give the new Quick Add feature a try by opening any solution. Right click on a folder or project and select Add > New Item… or type Ctrl+Shift+A, just as in the past. Instead of the old New Item Dialog, you’ll see the Quick Add Dialog!

Screenshot of the Add New Item dialog being used to add a new class to a project.

With the quick add dialog, you can:

  1. Add a new file without browsing through the template list: MyClass.cs
  2. Create nested folders in a single operation: Folder1/Folder2/, Folder1/Folder2/MyFile.cs
  3. Add files with any extension, or no extension at all: File.MyExtension, README, .gitignore TIP: Quick Add prepopulates a default extension for you, but you can hit Escape after opening the dialog to quickly clear the input box.
  4. Add multiple files at once: File1.cs, File2.html or File.(cs, txt). The first example will create a File1.cs and File2.html. The second example will create a File.cs and a File.txt.

You can also quickly switch between the Quick Add Dialog and New Item Dialog. Visual Studio will remember your choice, so you get the experience that suits your needs best! And if you’d like to return directly to the Quick Add Dialog regardless of previous state, you can type Shift+F2. Keyboard shortcuts are configurable in Tools > Options > Environment > Keyboard.

  1. Use “Show All Templates” to open the New Item Dialog
  2. Use “Show Compact View” to open the Quick Add Dialog

We want your feedback!

Quick Add is inspired by the Add New File extension. If you liked Add New File, we want you to love Quick Add! Quick Add adopts the same keyboard shortcut Add New File used, so you don’t have to memorize a new one.

If you’re interested in this feature, install the latest preview version of Visual Studio and try it out! Note that we’re still tuning the algorithm that chooses a template based on the project type and the file name you entered, so please let us know how we can improve it. Share your thoughts with us on the Add the extension “Add new file” as baseline ticket on Developer Community and vote by clicking thumbs-up/thumbs-down in the dialog.

Author

Josh Stevens
Senior Software Engineer

Josh is a senior engineer at Microsoft with more than 20 years of experience on the Visual Studio team.

26 comments

Discussion is closed. Login to edit/delete existing comments.

  • Michael Morawietz

    Es ist total umständlich, mit eurem "Add New Item" - Dialog. Weshalb kann man nicht einfach eine Datei anlegen, z.B. wie in VSCode mit STRG +N. Dann schreibt man den Dateinamen hin, drückt RETURN und ist in einem schönen leeren Editor.

    Macht es doch bitte einfach so, dass man diesen Template-Dialog deaktivieren kann.

    Wer gerne viel mit der Maus rumklickt und auch Spass daran hat, den unpassenden Template-Code umzuschreiben oder sogar ganz...

    Read more
  • Jason Puchyr

    Quick Add isn't using any template.

    Never had any issues with Mads' extension.

    Now, after updating my Visual Studio 2022
    CTRL+SHIFT+A opens the full add dialog - creating a Whatever.cs file uses the Class template, as expected.

    SHIFT+F2 (my shortcut for the extension) opens the quick add dialog - but creating Whatever.cs just opens a new completely blank file.

    I've tried disabling then uninstalling the "Add New File (64-bit)" extension, but still same behaviour.
    How do I disable the...

    Read more
    • Josh StevensMicrosoft employee Author

      What kind of project are you seeing this behavior in?

  • Pavel Voronin

    I want the same support for .templates folder as extension has.

  • Miles Gibson

    Finally a little “de-bloating” happening. It is super annoying to Add an item, then have to wait for a long list of template options to appear, all just when I want to add a simple .cs class file. This is the type of behaviour that should be standard and not a “new feature”. None-the-less, good work!

  • Kaizonaro

    Im on 17.5.0 Preview 2.0 but i cant use this feature yet.

    • Michael Taylor

      Meaning it doesn't show up? It is only available if you right click a project\folder in Solution Explorer and then select `Add \ New Item`. It should then show you the minimal UI. If it jumps straight to the full view then it is possible you "disabled" it earlier. In the bottom left corner of the UI there should be a "Show Compact View" option to switch back to the minimal view.

      If that isn't available...

      Read more
  • Cesar Diaz

    awesome tool, any way to make the file accessor public by default when creating classes???

    • Lukas · Edited

      You can edit the class template file:

      C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs

      This allows you to change the class to public, namespace imports, add copyright headers, etc etc…

      Note: File path must be adapted to VS edition and installation folder.

  • Ana William

    Thank you for the information, Happy Holiday

  • Michael FultonMicrosoft employee · Edited

    Awesome. Adding a simple JSON file no longer be 10+ clicks! Rejoice!

  • Sergei Churbanov

    If I need to add new class I just write it besides some existings and use refactoring – Extract To Separate File. IMO, it’s more useful to have all classes in one file when you just sketching out prototype for some features.

    If I need to add something more complicated, like XAML class from template I will have to use old “Add Item” menu.

    However respect for UI improvement endeavors.

    • Michael Taylor

      I agree, this is the way I go. It auto-copies all the file headers, existing using statements, namespace declarations, etc without issue. However I have 2 of these options (one from another extension) and one of the options ignore the namespace syntax preference (I believe the extension) whereas the other one (the built in one I think) does recognize that I want the simplified namespace syntax instead of namespace blocks. I don't know that the...

      Read more
  • Edy Kusnandar

    Thanks Information