Home > front end >  VS 2022 17.1.3 Empty new class
VS 2022 17.1.3 Empty new class

Time:04-07

When adding a new class, it only creates it with namespace and without usings. I had no such problem before in VS19. How can i fix it? enter image description here

I tried to reinstall vs

CodePudding user response:

As said, Try to add new controller class it would add using block, but for new class it won't, because, your class doesn't use any additional refereces which need to add initially, in Visual studio lastest release for adding new class it won't add any using block since it doesn't has any reference to add.

Note: If you would just try it before dotnet core 3.1 you would see that it would add using block. as below:

enter image description here

Since dotnet 5 and 6compiler automatically adds a set of using directives based on the project type. You can enter image description here

So hope you get the difference already. It’s not an issue, it’s a new features in latest dotnet release to redeem repetitive using directive monotonously.

  • Related