Hi,
I'm trying to create templates for a common project configuration at my work. We are using property sheets to share common configuration across the C++ projects, and I want to include these as part of the standard template for projects added to the solution. However, the JScript approach for the Custom Wizard seems like it may not support either the newer AddPropertySheet method on the configuration object (calling it results in an error: "Variable uses an Automation type not supported in JScript"), or the older InheritedPropertySheets property (trying to set it results in another error: "Object does not support this action").
The JScript file is (so far) just the automatically generated default.js, but with the following code for the AddConfig functionfunction AddConfig(proj, strProjectName) { try { var config = proj.Object.Configurations('Debug'); config.AddPropertySheet("C:\projects\Test Wizard1\PropertySheets\DebugConfig.props"); var CLTool = config.Tools('VCCLCompilerTool'); // TODO: Add compiler settings var LinkTool = config.Tools('VCLinkerTool'); // TODO: Add linker settings config = proj.Object.Configurations('Release'); config.AddPropertySheet("C:\projects\Test Wizard1\PropertySheets\ReleaseConfig.props"); var CLTool = config.Tools('VCCLCompilerTool'); // TODO: Add compiler settings var LinkTool = config.Tools('VCLinkerTool'); // TODO: Add linker settings } catch (e) { throw e; } }
With just the addition of those two AddPropertySheet lines - error.
Trying to create the custom wizard and templates through any approach that doesn't use the JScript seems to be a non-starter, since every other template-related project in Visual Studio looks to be assuming that the resulting project is going to be C# (or at least anything but C++) - everything I've looked at required an exported template project, which Visual Studio won't do with a C++ project.
Is there a way to properly call the AddPropertySheet method from JScript? Or is there a better way to make custom C++ project templates? If this were just for me, I'd give up and just write a Perl script to generate the .vcxproj, .cpp, and .h files from templates (it's looking significantly easier), but I do want this to be easy for my coworkers to install and use.
Thanks,
Christopher