Visual Studio – Add New File

Today I was just using Visual Studio 2019 and was creating some useful feature to my product. I was thinking like everything was going on fine but at that moment of time, I tried to create a new .cs file where my Visual Studio got crashed.

Yes agree, it crashed because of too much apps running on my Windows and used a shortcut(Ctrl + N) for creating that. Sometimes it is working fine and sometimes my Visual Studio is getting crashed.

If there’s a problem, there are many ways to solve it.

So there was a best way to solve that using Add New File Extension which you can install in Visual Studio.

How To Install?

  1. Open Visual Studio 2019.
  2. Goto Extensions and choose Manage Extensions.

3. And search for Add New File Extension where you should be able to download.

4. Once you downloaded, close all the instances of Visual Studio such that it will install the respective extension.

What Can you do with that extension?

Once it is installed open some sample solution to try out the extension. Now to create a New File you can use Shift + F2 and you can feel it is very much faster than Ctrl+N.

Brilliant

So if you want to create a .cs file just mention the respective filename.cs and it would create a new class file in C#.

If you want to create a interface, just mention as ISample.cs and it will create you an interface.

Suppose if you have folder structure like Main Solution/service and if you want to create a new file under service folder,

  • Just select the service folder
  • And press Shift+F2 and mention the respective folder name as testfile.cs

You can also create folders

If you want to create a new folder under Main Solution, just select the solution and press Shift + F2 and type as {foldername}/ and press Enter.

Summary

It’s a very powerful extension and try it out to increase your productivity. And also it avoids crashing Visual Studio 2019.

This extension was developed by Mads Kristensen – Program Manager – Visual Studio.

Share me some of the interesting extensions which you have came across in Visual Studio in the comments.

Happy Shift + F2!

Cheers šŸ™‚

One thought on “Visual Studio – Add New File

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: