xvdiff xvdiff - 3 years ago 57
C# Question

Automating project creation in VS

If you straight-forward create a project in Visual Studio (let's say a console application) by clicking on "Console Application Project" in the project wizard and name it appropriately, it usually results in the following file structure:


There's an option for creating an extra folder for the solution, which results in...


Both of them are undesireable because they lead to problems with long file/folder names, especially when the project is already located in a very deep hierarchy.

Desireble would be something along the lines of this:


In order to achieve this, I have to do the same repeating step over and over again

  1. Create empty solution with only the projects name

  2. Navigate to the solution folder, create a folder "src"

  3. Create a project with only the projects type name (e.g. Ui, Frontend, Console..)

  4. Rename project according to company naming guidelines

  5. Rename assembly/namespace

  6. Adjust namespace in files (okay, I got ReSharper, so this is quickly done).

Is there any way to automate this? Maybe with a custom wizard or extension?

Answer Source

You can create your own project layout template for Visual Studio by following the steps on MSDN on how to create your own Project Templates.
After creating the template, you can create the deployment file, to use on all team member installations so that everyone has them.

This way you can define everything exactly how you want it to be and not have to go through all the steps that you mentioned.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download