static internal void MakeTemplateReplacements(bool isAProject, bool creatingProject, string rootNamespace, string sourceFileName, _BE.Project proj) { if (isAProject) { if (!string.IsNullOrEmpty(rootNamespace)) { _BE.ProjectProperty prop; string name; name = "StartupObject"; prop = proj.GetProperty(name); if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace + ".", "$safeprojectname$.")); name = "DocumentationFile"; prop = proj.GetProperty(name); if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace + ".", "$safeprojectname$.")); name = "RootNamespace"; prop = proj.GetProperty(name); if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace, "$safeprojectname$")); name = "AssemblyName"; prop = proj.GetProperty(name); if (prop != null) proj.SetProperty(name, prop.UnevaluatedValue.Replace(rootNamespace, "$safeprojectname$")); } } else { if (creatingProject == true) { //Exporting the entire project ... replace projectname only; this may not work as desired for Web projects, //we don't have any so we don't care. WordReplace(proj, rootNamespace, "$safeprojectname$"); } else { //Exporting a single item from a project. Replace root name space (if given) //and item name if (!string.IsNullOrEmpty(rootNamespace)) { WordReplace(proj, rootNamespace, "$rootnamespace$"); } string itemName = Path.GetFileNameWithoutExtension(sourceFileName); int iDotIndex = itemName.LastIndexOf("."); if (iDotIndex != -1) { //This is intended to fix the foo.designer.vb case (GetFileNameWithoutExtension() //returns foo.designer, and we want to replace just foo itemName = itemName.Substring(0, iDotIndex); } WordReplace(proj, itemName, "$safeitemname$"); } } }