Just to give you couple of ideas:
private void WriteSingleMSBuildFile(List<ProjectItem> projectToWrite, string compilerOutputPath, string msBuildConfigPath)
{
foreach (ProjectItem item in projectToWrite)
{
string msbuildFilename = string.Format("{0}.msbuild", Path.GetFileNameWithoutExtension(item.FullPath));
string outputFile = Path.Combine(msBuildConfigPath, msbuildFilename);
using (StreamWriter msbuildFile = new StreamWriter(outputFile))
{
msbuildFile.WriteLine(GetMSBuildFileHeader(item));
msbuildFile.WriteLine(GetMSBuildFileDetails(item));
msbuildFile.WriteLine(GetMSBuildFileFooter(item));
msbuildFile.Close();
}
}
}
All you have to work out now is how to write the three methods
GetMSBuildFileHeader(ProjectItem item)
,
GetMSBuildFileDetail(ProjectItem item)
and
GetMSBuildFileFooter(ProjectItem item)
.
Regards,
—MRB