none
new project default startup visual studio 2015

    Question

  • I am new to Visual Studio 2015 lightweight with only C++ installed and I'm fairly new to C++ programming, I've done  C for a couple of years now. My question is, how can i change the default startup code when I create a new project? I primarily do Win32 console app. When you create a new project by default it loads with a few lines of code to get started with but I would like to add more code to it so when i start new projects, it has more code loading when it first starts up. 


    For example, instead of starting with just:


    // ConsoleApplication1.cpp : Defines the entry point for the console application.
    //
    #include "stdafx.h"

    int main()
    {
        return 0;
    }


    It will start with something like: (just as a basic example)


    // <file name>
    // <my name>

    // <date>


    #include "stdafx.h"
    #include <iostream>
    #include <string>
    using namespace std;

    int main()
    {
        return 0;
    }

    Tuesday, April 19, 2016 12:27 AM

Answers

  • Hi bvillar110,

    Thank you for your post.

    >>how can i change the default startup code when I create a new project?

    You could create a custom project template with the standard Export Template wizard, please take the following steps:

    1.Create a project and until it is ready to be exported as a template.

    2.On the File menu, click Export Template. The Export Template wizard opens.

    3.Click Project Template.

    4.Click Next.

    5.Select an icon and a preview image for your template. These will appear in the New Project dialog box.

    6.Enter a template name and description.

    7.Click Finish. Your project is exported into a .zip file and placed in the specified output location, and, if selected, imported into Visual Studio.

    I did a test to create a sample template as you mentioned in the initial post, export the UnitTest(export) template and it succeed, please see the screenshot:

    Best Regards,

    Lake Xiao

    Tuesday, April 19, 2016 9:02 AM
    Moderator