xvdiff
xvdiff

Reputation: 2229

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:

MyCompany.MyProject\
    MyCompany.MyProject.csproj
    MyCompany.MyProject.sln

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

MyCompany.MyProject\
    MyCompany.MyProject.sln
    MyCompany.MyProject\
        MyCompany.MyProject.csproj

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:

MyProject\
    MyCompany.MyProject.sln
    src\
        ConsoleApp\
            MyCompany.MyProject.ConsoleApp.csproj

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?

Upvotes: 2

Views: 867

Answers (3)

Bernd Linde
Bernd Linde

Reputation: 2152

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.

Upvotes: 4

live2
live2

Reputation: 4275

You can try Nager.TemplateBuilder it is easy to design the project structure and you can start it as a console application.

Upvotes: 0

Ilya Kozhevnikov
Ilya Kozhevnikov

Reputation: 10432

You can try SideWaffle and read through the wiki or other tutorials on creating your own packs and templates.

Upvotes: 0

Related Questions