Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi

I am trying to create a project template so that I do not have to go through all of the settings to create new projects. But I am hitting a brick wall trying to figure out how to add props files that I have generated. These files outline a few settings that I need consistent in all my projects.

In the default.js script I am trying to understand how to get the prop file to be added into the generated project. I know I have to do something probably in AddConfig function in the default.js file, but I have no idea what function to call to load already pre-existing props file. I tried adding AddPropertySheet but it just crashes the VS2010 when I try to create a new project based on this wizard.

I generated the props file using property manager.

Any help would be greatly appreciated.

JavaScript
function AddConfig(proj, strProjectName)
{
	try
	{
	    var config = proj.Object.Configurations('Debug');
                
            //THIS CAUSES A CRASH
            config.AddPropertySheet( 'C:\default.props');

		var CLTool = config.Tools('VCCLCompilerTool');
		// TODO: Add compiler settings
		CLTool.PreprocessorDefinitions = 'WIN32;_DEBUG;_CONSOLE';

		var LinkTool = config.Tools('VCLinkerTool');
		// TODO: Add linker settings

		config = proj.Object.Configurations('Release');


		var CLTool = config.Tools('VCCLCompilerTool');
		CLTool.PreprocessorDefinitions = 'WIN32;NDEBUG;_CONSOLE';
		// TODO: Add compiler settings

		var LinkTool = config.Tools('VCLinkerTool');
		// TODO: Add linker settings
	}
	catch(e)
	{
		throw e;
	}
}
Posted
Updated 14-Jan-15 13:27pm
v2

1 solution

See Visual C++ Express, Custom Wizard[^], which may help you.
 
Share this answer
 
Comments
godspeed123 15-Jan-15 11:27am    
I have looked at this, they do no mention how to add props files to the template.
Richard MacCutchan 15-Jan-15 12:40pm    
It's just anotther file that you add to the templates and copy to the relevant directory, in the same way you copy all the others. My project shows how to do it.
godspeed123 19-Jan-15 15:53pm    
Hi Richard,

Thank you for your response. Yes I understand that physically adding the file into the template works. But when I try to add it in the AddConfig function like:

config.AddPropertySheet( 'default.props');

Visual Studio crashes with this call when I try to generate a project from the template. If I remove this call it works fine.
Richard MacCutchan 20-Jan-15 3:40am    
Sorry, I can't offer any suggestion, you will need to do some investigation into why it crashes. My own experience of such problems is that they are extremely difficult to diagnose, because you cannot get any debug information to help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900