In Visual Studio 2019, when I create a new .NET Framework Console Application in C#, it places the entry point in a class called Program
in a file named Program.cs
and a namespace with the same name as my project:
namespace ProjectName
{
class Program
{
static void Main(string[] args)
{
}
}
}
I always just end up removing the namespace and renaming the class and file to EntryPoint
(.cs
), putting the entry point class in the global namespace.
sealed class EntryPoint
{
static void Main(string[] args)
{
}
}
Is there any way I can make this the default behavior for all new projects of this type from now on without manually doing that each time? In other words, can I change how the default files in this type of project look?
CodePudding user response:
This can be helpful How can I change the default Visual Studio C# new class file template? [duplicate]
From the docs:
By default, templates installed with Visual Studio are located in:
- %ProgramFiles(x86)%\Microsoft Visual Studio\2019\[edition]\Common7\IDE\ProjectTemplates\[Language]\[Locale ID]
For example on my machine - C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ProjectTemplates