Search code examples
visual-studio-2010auto-generate

Visual Studio 2010 extension for generating C++ code?


I've been spending all day trying to figure out if it's possible for VS2010 to generate a code template using variables. I'm taking a C++ class wanted to avoid copy/pasting each time I create a new CPP file. I was just looking at doing it for a simple win32 console app so it's just once cpp file. Is this even possible with VS2010?

/**
    @file <Filename>
    @author <Name>
    @date <Date>
    @version 1.0
*/

#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    return 0;
}

Thanks,
LF4


Solution

  • You may be able to achieve what you want by creating a project and then use the Export Template Wizard to turn your project into a project template. You can also create a project template manually. You can read more about project templates here.

    For more elaborate templates you can create a Visual C++ Custom Wizard.