Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can I change the content of default files in a Visual Studio project type?

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading