Eris
Eris

Reputation: 35

Change default class item template provided by AddClass Wizard in vs2017

I want to create a class template that would account for the precompiled header if present (which happens with the default add class wizard), but I'd like to expand the barebone template provided by the wizard with a constructor, (possibly virtual) destructor and a bunch of private and public sections. I have read the microsoft pages talking about item templates, but I cannot seem to find the functionality that would allow me to account for the precompiled header.

Is there a way (even a hacky one) of modifying the add class wizard without having to create a vs extension from scrap?

Something similar seems to be possible with C# templates as can be seen from various posts advising to modify Class.cs in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class, unfortunately, I cannot find the C++ equivalent.

Upvotes: 0

Views: 197

Answers (1)

Minxin Yu - MSFT
Minxin Yu - MSFT

Reputation: 4149

What you want to achieve is somewhat difficult: override default c++ class template in visual studio 2010

modify item template may be easier:

1.Add class through class wizard and code

#pragma once
class Myclass
{
public:
    Myclass();
    ~Myclass();
protected:
    int test();

private :
};
  1. Tool bar: Project-> Export Template->Item template

  2. Then you can add custom item(may need to restart Visual Studio)

E.g.

enter image description here

#pragma once
class hello
{
public:
    hello();
    ~hello();
protected:
    int test();

private :
};

Upvotes: 1

Related Questions