Skip to content

Quick Add New File (Shift+F2)

The fastest way to create files in your .NET projects.

Quick Add New File is activated with Shift+F2 and provides instant file creation with intelligent defaults.

  1. Select a folder or project in Solution Explorer
  2. Press Shift+F2
  3. Enter a filename: MyClass.cs
  4. Press Enter

The file is created with:

  • Appropriate template based on filename
  • Correct namespace
  • Standard formatting
  • Ready to edit

The extension detects file types automatically:

  • IMyService.cs → Interface template
  • MyEnum.cs → Enum template
  • PersonRecord.cs → Record template
  • MyController.cs → Controller template (in web projects)
  • MyTest.cs → Test class (in test projects)

Create several files at once:

UserService.cs, IUserService.cs, UserDto.cs

All three files are created in the selected location.

Include folder paths:

Services/UserService.cs, Models/User.cs, Tests/UserTests.cs

Folders are created automatically if they don’t exist.

Create a folder by adding a trailing slash:

NewFolder/

Combine folder and file creation:

Utils/, Utils/StringHelper.cs

Create complex folder hierarchies:

Features/Users/Services/UserService.cs

All intermediate folders are created automatically.

Authentication/AuthService.cs, Authentication/IAuthService.cs

Both files are created inside the new Authentication folder.

Services/IUserService.cs, Services/UserService.cs, Services/Dto/UserDto.cs
Features/Orders/OrdersController.cs, Features/Orders/OrderService.cs, Features/Orders/OrderViewModel.cs
Tests/Unit/UserServiceTests.cs, Tests/Integration/UserIntegrationTests.cs

For an interface and implementation:

IMyService.cs, MyService.cs

Create related files together:

User.cs, UserDto.cs, UserValidator.cs, UserProfile.cs
Features/Users/Commands/, Features/Users/Queries/, Features/Users/Models/

All created files get the correct namespace based on:

  • Project root namespace
  • Folder location within project
  • .NET conventions
  • Files appear immediately in the tree
  • No manual refresh needed
  • Can edit files right away
  • New files are recognized instantly
  • Types are available for IntelliSense
  • No project reload required

If a file isn’t created:

  1. Check filename is valid (no special characters)
  2. Verify you have write permissions
  3. Ensure parent folder exists or will be created
  4. Check Output panel for errors

If the wrong template is used:

  1. Use explicit naming (e.g., IMyInterface.cs for interfaces)
  2. Manually edit the generated file
  3. Future files will use pattern matching

If namespace is wrong:

  1. Check project settings
  2. Verify folder structure
  3. Use the namespace adjustment feature to fix