Creating Visual Studio Templates
Posted
by vanja.
on Stack Overflow
See other posts from Stack Overflow
or by vanja.
Published on 2008-11-03T01:34:48Z
Indexed on
2010/05/27
15:11 UTC
Read the original article
Hit count: 248
I'm looking to create a Visual Studio 2008 template that will create a basic project and based on remove certain files/folders based on options the user enters.
Right now, I have followed some tutorials online which have let me create the form to query the user and pass the data into an IWizard class, but I don't know what to do from there.
The tutorials provide a sample to do some simple substitution: code:
Form1 form = new Form1();
DialogResult dlg = form.ShowDialog();
if (dlg == DialogResult.OK)
{
foreach (KeyValuePair<string, string> pair in form.Parameters)
{
if (!replacementsDictionary.ContainsKey(pair.Key))
replacementsDictionary.Add(pair.Key, pair.Value);
else
replacementsDictionary[pair.Key] = pair.Value;
}
}
form.Close();
but I'm looking to selectively include files based on the user settings, and if possible, selectively include code sections in a file based on settings.
Is there a clever way to do this, or will I manually have to delete project files in the IWizard:ProjectFinishedGenerating()?
© Stack Overflow or respective owner