private void EnsureCpsProjFile(string cpsProjFileName) { var fileInfo = new FileInfo(cpsProjFileName); if (fileInfo.Exists) { return; } var inMemoryTargetsFile = FileSystemMirroringProjectUtilities.GetInMemoryTargetsFileName(cpsProjFileName); var xProjDocument = new XProjDocument( new XProject(Toolset.Version, "Build", new XPropertyGroup("Globals", null, new XProperty("ProjectGuid", Guid.NewGuid().ToString("D")) ), new XPropertyGroup( new XDefaultValueProperty("VisualStudioVersion", Toolset.Version), new XDefaultValueProperty("Configuration", "Debug"), new XDefaultValueProperty("Platform", "AnyCPU") ), CreateProjectSpecificPropertyGroup(cpsProjFileName), CreateProjectUiSubcaption(), new XProjElement("ProjectExtensions", new XProjElement("VisualStudio", new XProjElement("UserProperties") ) ), new XProjElement("Target", new XAttribute("Name", "Build")), _msBuildImports.SelectMany(CreateMsBuildExtensionXImports), new XImportExisting(inMemoryTargetsFile) ) ); using (var writer = fileInfo.CreateText()) { xProjDocument.Save(writer); } }
static FileSystemMirroringProject() { EmptyProject = new XProjDocument(new XProject()); }