本文整理汇总了C#中IProject.Save方法的典型用法代码示例。如果您正苦于以下问题:C# IProject.Save方法的具体用法?C# IProject.Save怎么用?C# IProject.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProject
的用法示例。
在下文中一共展示了IProject.Save方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: reorderItems
public static void reorderItems(TreeNodeCollection nodes, IProject project)
{
//ProjectService.MarkProjectDirty(project)
project.Save();
XmlDocument doc = new XmlDocument();
doc.Load(project.FileName);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("proj", "http://schemas.microsoft.com/developer/msbuild/2003");
var d = new Dictionary<FileNode, XmlNode>();
foreach (FileNode node in getFileNodes(nodes)) {
var docNode = doc.SelectSingleNode("//proj:Compile[@Include=\"" + Path.GetFileName(node.FileName) + "\"]", nsmgr);
if (docNode != null) {
d[node] = docNode;
docNode.ParentNode.RemoveChild(docNode);
}
}
var itemNode = doc.SelectSingleNode("//proj:ItemGroup", nsmgr);
foreach (FileNode node in getFileNodes(nodes)) {
XmlNode xmlElem;
if (d.TryGetValue(node, out xmlElem))
itemNode.AppendChild(xmlElem);
}
SaveProjectXml(doc, project as FSharpProject);
}
示例2: Run
public void Run(IProject project)
{
if (project != null) {
ReferenceProjectItem nunitRef = new ReferenceProjectItem(project, "nunit.framework");
ProjectService.AddProjectItem(project, nunitRef);
project.Save();
}
}
示例3: Save
public void Save(IProject project)
{
if (WorkbenchSingleton.InvokeRequired) {
Action<IProject> action = Save;
WorkbenchSingleton.SafeThreadCall<IProject>(action, project);
} else {
project.Save();
}
}
示例4: SaveAndOpenNewClassDiagram
void SaveAndOpenNewClassDiagram(IProject p, string filename, XmlDocument xmlDocument)
{
xmlDocument.Save(filename);
FileProjectItem fpi = new FileProjectItem(p, ItemType.Content);
fpi.FileName = filename;
ProjectService.AddProjectItem(p, fpi);
ProjectBrowserPad.RefreshViewAsync();
p.Save();
FileService.OpenFile(filename);
}
示例5: ProvisionOpenOCDSettings
public static OpenOCDSettings ProvisionOpenOCDSettings(IProject project)
{
var result = GetSettings(project);
if (result == null)
{
project.DebugSettings.OpenOCDSettings = new OpenOCDSettings();
result = project.DebugSettings.OpenOCDSettings;
project.Save();
}
return result;
}
示例6: AddReference
public AddReferenceResponse AddReference(IProject project, string reference)
{
var response = new AddReferenceResponse();
var projectToReference = _solution.Projects.First(p => p.FileName.Contains(reference));
var projectXml = project.AsXml();
var referenceNodes = GetReferenceNodes(projectXml, "ProjectReference");
var relativeProjectPath = project.FileName.GetRelativePath(projectToReference.FileName);
var projectReferenceNode = CreateProjectReferenceNode(relativeProjectPath, projectToReference);
var projectAlreadyAdded = referenceNodes.Any(n => n.Attribute("Include").Value.Equals(relativeProjectPath));
if (IsCircularReference(project, projectToReference))
{
response.Message = "Reference will create circular dependency";
return response;
}
if (!projectAlreadyAdded)
{
var projectContainsProjectReferences = referenceNodes.Count > 0;
if (projectContainsProjectReferences)
{
referenceNodes.First().Parent.Add(projectReferenceNode);
}
else
{
var projectItemGroup = new XElement(MsBuildNameSpace + "ItemGroup");
projectItemGroup.Add(projectReferenceNode);
projectXml.Element(MsBuildNameSpace + "Project").Add(projectItemGroup);
}
project.AddReference(new ProjectReference(_solution, projectToReference.Title));
project.Save(projectXml);
response.Message = string.Format("Reference to {0} added successfully", projectToReference.Title);
}
else
{
response.Message = "Reference already added";
}
return response;
}
示例7: AddReference
public AddReferenceResponse AddReference(IProject project, string reference)
{
var response = new AddReferenceResponse();
var projectXml = project.AsXml();
var referenceNodes = GetReferenceNodes(projectXml, "Reference");
var referenceAlreadyAdded = referenceNodes.Any(n => n.Attribute("Include").Value.Equals(reference));
if (!referenceAlreadyAdded)
{
var fileReferenceNode = CreateReferenceNode(reference);
if (referenceNodes.Count > 0)
{
referenceNodes.First().Parent.Add(fileReferenceNode);
}
else
{
var projectItemGroup = new XElement(MsBuildNameSpace + "ItemGroup");
projectItemGroup.Add(fileReferenceNode);
projectXml.Element(MsBuildNameSpace + "Project").Add(projectItemGroup);
}
var assemblyPath = project.FindAssembly (reference);
if (assemblyPath != null)
{
project.AddReference (assemblyPath);
project.Save (projectXml);
response.Message = string.Format ("Reference to {0} added successfully", reference);
}
else
{
response.Message = "Did not find " + reference;
}
}
else
{
response.Message = "Reference already added";
}
return response;
}
示例8: AddReference
public AddReferenceResponse AddReference(IProject project, string reference)
{
var response = new AddReferenceResponse();
var projectXml = project.AsXml();
var referenceNodes = GetReferenceNodes(projectXml, "Reference");
var relativeReferencePath = project.FileName.GetRelativePath(reference);
var referenceName = reference.Substring(reference.LastIndexOf("\\") + 1).Replace(".dll", "");
var referenceAlreadyAdded = referenceNodes.Any(n => n.Attribute("Include").Value.Equals(referenceName));
var fileReferenceNode = CreateReferenceNode(relativeReferencePath, referenceName);
if (!referenceAlreadyAdded)
{
if (referenceNodes.Count > 0)
{
referenceNodes.First().Parent.Add(fileReferenceNode);
}
else
{
var projectItemGroup = new XElement(MsBuildNameSpace + "ItemGroup");
projectItemGroup.Add(fileReferenceNode);
projectXml.Element(MsBuildNameSpace + "Project").Add(projectItemGroup);
}
project.AddReference(reference.LowerCaseDriveLetter());
project.Save(projectXml);
response.Message = string.Format("Reference to {0} added successfully", referenceName);
}
else
{
response.Message = "Reference already added";
}
return response;
}
示例9: Save
public void Save(IProject project)
{
project.Save();
}
示例10: AddProjectReferenceToProject
static void AddProjectReferenceToProject(IProject project, IProject referenceTo)
{
LoggingService.Warn("Adding project reference to project.");
ProjectReferenceProjectItem reference = new ProjectReferenceProjectItem(project, referenceTo);
ProjectService.AddProjectItem(project, reference);
project.Save();
}
示例11: AddReferenceToProject
static void AddReferenceToProject(IProject project, AssemblyName referenceName)
{
LoggingService.Warn("Adding reference to project: " + referenceName.FullName);
ReferenceProjectItem reference = new ReferenceProjectItem(project, "Reference");
ToolComponent toolComponent = ToolboxProvider.ComponentLibraryLoader.GetToolComponent(referenceName.FullName);
if (toolComponent == null || toolComponent.HintPath == null) {
reference.Include = referenceName.FullName;
LoggingService.Debug("Added GAC reference to project: " + reference.Include);
} else {
reference.Include = referenceName.FullName;
reference.HintPath = FileUtility.GetRelativePath(project.Directory, toolComponent.FileName);
LoggingService.Debug("Added assembly reference to project: " + reference.Include);
}
ProjectService.AddProjectItem(project, reference);
project.Save();
}
示例12: Build
//.........这里部分代码省略.........
var result = await PreBuild(console, project);
console.WriteLine("Starting Build...");
terminateBuild = !result;
SetFileCount(project as IStandardProject);
buildCount = 0;
var compiledProjects = new List<CompileResult>();
List<Definition> injectedDefines = new List<Definition>();
if (defines != null)
{
foreach (var define in defines)
{
var injectableDefinition = new Definition() { Global = true, Value = define };
(project as IStandardProject).Defines.Add(injectableDefinition);
injectedDefines.Add(injectableDefinition);
}
}
if (!terminateBuild)
{
await CompileProject(console, project as IStandardProject, project as IStandardProject, compiledProjects);
if (!terminateBuild)
{
await WaitForCompileJobs();
foreach (var compiledReference in compiledProjects)
{
result = compiledReference.ExitCode == 0;
if (!result)
{
break;
}
}
if (result)
{
var linkedReferences = new CompileResult();
linkedReferences.Project = project as IStandardProject;
foreach (var compiledProject in compiledProjects)
{
if (compiledProject.Project.Location != project.Location)
{
var linkResult = Link(console, project as IStandardProject, compiledProject, linkedReferences);
}
else
{
// if (linkedReferences.Count > 0)
{
linkedReferences.ObjectLocations = compiledProject.ObjectLocations;
linkedReferences.NumberOfObjectsCompiled = compiledProject.NumberOfObjectsCompiled;
var linkResult = Link(console, project as IStandardProject, linkedReferences, linkedReferences, label);
result = await PostBuild(console, project, linkResult);
}
}
if (linkedReferences.ExitCode != 0)
{
result = false;
break;
}
}
}
ClearBuildFlags(project as IStandardProject);
}
}
console.WriteLine();
if (terminateBuild)
{
result = false;
}
if (result)
{
console.WriteLine("Build Successful");
}
else
{
console.WriteLine("Build Failed");
}
foreach(var define in injectedDefines)
{
(project as IStandardProject).Defines.Remove(define);
}
project.Save();
return result;
}
示例13: ProvisionSettings
public override void ProvisionSettings(IProject project)
{
var result = GetSettings(project);
if (result == null)
{
project.DebugSettings.JLinkSettings = new JLinkSettings();
result = project.DebugSettings.JLinkSettings;
project.Save();
}
}
示例14: ProvisionClangSettings
public static ClangToolchainSettings ProvisionClangSettings(IProject project)
{
var result = GetSettings(project);
if (result == null)
{
project.ToolchainSettings.ClangToolchainSettings = new ClangToolchainSettings();
result = project.ToolchainSettings.ClangToolchainSettings;
project.Save();
}
return result;
}