Hi Sonu,
You can add a nested file creating your own AddItemFromString action to add the second item.
Basically you can do the same what is doing the AddItemFromString action which is writing the content to a temporary file and then add the content to the project in the following way:
string tempfile = Path.GetTempFileName();
using (StreamWriter sw = new StreamWriter(tempfile, false))
{
sw.WriteLine(
this.content);
}
project.ProjectItems.AddFromTemplate(tempfile,
"foo.cs");
so, you have to change the project for projectItem which also have a collection of ProjectItems which in fact is the nested child collection.
you code should looks like this:
string tempfile = Path.GetTempFileName();
using (StreamWriter sw = new StreamWriter(tempfile, false))
{
sw.WriteLine(this.content);
}
projectItem.ProjectItems.AddFromTemplate(tempfile, "foo.cs");
where "foo.cs" will be the name of the new item.
You can get the projectItem from the first AddItemFromString action using the output argument ProjectItem.
hope it helps.
jose.