private void menuAddFeature_Click(object sender, EventArgs e) { SetupFeature feature = new SetupFeature(); currentProject.projectFeatures.Add(feature); SynchFeatures(true); }
private void addDirectoryMenu_Click(object sender, EventArgs e) { SetupFeature feature = null; try { feature = (SetupFeature)featuresTree.SelectedNode.Tag; } catch (NullReferenceException) { return; } // Open file-dialog FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.Description = "Select a directory to add"; dlg.SelectedPath = LastSelectedFolder; if (dlg.ShowDialog() == DialogResult.OK) { LastSelectedFolder = dlg.SelectedPath; string file = dlg.SelectedPath; if ((File.GetAttributes(file) & FileAttributes.Directory) == FileAttributes.Directory) { string my_file = currentProject.projectProperties.UseRelativePaths ? Shell.GetRelativePath(file) : file; feature.directories.Add(new SetupDirectory(my_file)); } ReloadDirectories(); } }
private void MenuAddShortcut_Click(object sender, EventArgs e) { if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; SetupShortcut shortcut = new SetupShortcut(); shortcut.srcPath = "[APPLICATIONFOLDER]"; if ((null != current.configurableDirectory) && ("" != current.configurableDirectory)) { shortcut.srcPath = "[" + current.configurableDirectory + "]"; } shortcut.dstPath = "[APPLICATIONFOLDER]\\New Shortcut"; shortcut.description = "Some Description"; current.shortcuts.Add(shortcut); ReloadShortcuts(); // Set the new one as selected foreach (ListViewItem item in shortcutList.Items) { if (item.Tag.Equals(shortcut)) { item.Selected = true; break; } } } }
private void addFilesMenu_Click(object sender, EventArgs e) { SetupFeature feature = null; try { feature = (SetupFeature)featuresTree.SelectedNode.Tag; } catch (NullReferenceException) { return; } // Open file-dialog OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = true; dlg.RestoreDirectory = true; if (dlg.ShowDialog() == DialogResult.OK) { // Add the target-files string[] files = dlg.FileNames; foreach (string file in files) { string my_file = currentProject.projectProperties.UseRelativePaths ? Shell.GetRelativePath(file) : file; SetupFile sf = feature.AddFile(my_file); } // Reload the file-list ReloadFileList(); } }
private void fileList_DragDrop(object sender, DragEventArgs e) { // Find the selcted feature SetupFeature feature = null; try { feature = (SetupFeature)featuresTree.SelectedNode.Tag; } catch (NullReferenceException) { return; } string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string file in files) { string my_file = currentProject.projectProperties.UseRelativePaths ? Shell.GetRelativePath(file) : file; SetupFile sf = feature.AddFile(my_file); } // Reload the file-list ReloadFileList(); }
private void featureName_TextChanged(object sender, EventArgs e) { if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; featuresTree.SelectedNode.Text = featureName.Text; } }
private void menuAddChildFeature_Click(object sender, EventArgs e) { if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; SetupFeature feature = new SetupFeature(); current.childFeatures.Add(feature); } SynchFeatures(true); }
private void MenuDeleteDirectory_Click(object sender, EventArgs e) { if ((null != featureDirectoryList.SelectedItems) && (featureDirectoryList.SelectedItems.Count == 1)) { if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; current.directories.Remove((SetupDirectory)featureDirectoryList.SelectedItems[0].Tag); ReloadDirectories(); } } }
private void MenuDeleteShortcut_Click(object sender, EventArgs e) { if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; foreach (ListViewItem item in shortcutList.SelectedItems) { current.shortcuts.Remove((SetupShortcut)item.Tag); } } ReloadShortcuts(); }
private void menuDeleteFeature_Click(object sender, EventArgs e) { if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; if (featuresTree.SelectedNode.Parent == null) { currentProject.projectFeatures.Remove(current); } else { SetupFeature parent = (SetupFeature)featuresTree.SelectedNode.Parent.Tag; parent.childFeatures.Remove(current); } SynchFeatures(true); } }
private void featureDirectoryList_DragDrop(object sender, DragEventArgs e) { if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string file in files) { if ((File.GetAttributes(file) & FileAttributes.Directory) == FileAttributes.Directory) { string my_file = currentProject.projectProperties.UseRelativePaths ? Shell.GetRelativePath(file) : file; current.directories.Add(new SetupDirectory(my_file)); } } ReloadDirectories(); } }
private void featuresTree_AfterSelect(object sender, TreeViewEventArgs e) { checkPartOfDefaultInstall.DataBindings.Clear(); checkPartOfMinimalInstall.DataBindings.Clear(); featureName.DataBindings.Clear(); featureDescription.DataBindings.Clear(); featureDefaultInstall.DataBindings.Clear(); featurePathPropertyName.DataBindings.Clear(); featurePathDefaultPath.DataBindings.Clear(); featureId.DataBindings.Clear(); shortcutProperties.SelectedObject = null; directoryProperties.SelectedObject = null; currentFileProperties.SelectedObject = null; featurePropertiesGrid.SelectedObject = null; if (e.Node != null) { SetupFeature feature = (SetupFeature)e.Node.Tag; checkPartOfDefaultInstall.DataBindings.Add("Checked", feature, "enableInDefaultInstall"); checkPartOfMinimalInstall.DataBindings.Add("Checked", feature, "enableInMinimalInstall"); featureName.DataBindings.Add("Text", feature, "featureName"); featureDescription.DataBindings.Add("Text", feature, "featureDescription"); featureDefaultInstall.DataBindings.Add("SelectedIndex", feature, "defaultInstallMode"); featurePathPropertyName.DataBindings.Add("Text", feature, "configurableDirectory"); featurePathDefaultPath.DataBindings.Add("Text", feature, "configurableDirectoryDefaultPath"); featureId.DataBindings.Add("Text", feature, "featureId"); featurePropertiesGrid.SelectedObject = feature; } ReloadFileList(); ReloadDirectories(); ReloadShortcuts(); }
private void ReloadShortcuts() { shortcutList.Items.Clear(); if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; if ((null != current) && (null != current.shortcuts)) { foreach (SetupShortcut shortcut in current.shortcuts) { ListViewItem i = new ListViewItem(Path.GetFileName(shortcut.dstPath)); i.SubItems.Add(Path.GetDirectoryName(shortcut.dstPath)); i.SubItems.Add(shortcut.srcPath); i.Tag = shortcut; shortcutList.Items.Add(i); } } } }
private void ReloadFileList() { fileList.Items.Clear(); SetupFeature feature = null; try { feature = (SetupFeature)featuresTree.SelectedNode.Tag; } catch (NullReferenceException) { return; } foreach (SetupComponent cmp in feature.components) { foreach (SetupFile file in cmp.componentFiles) { ListViewItem item = new ListViewItem(file.dstName); item.SubItems.Add(cmp.targetDirectory); item.SubItems.Add(file.srcName); item.SubItems.Add(file.srcDirectory); FileBinding bind = new FileBinding(); bind.mComponent = cmp; bind.mFeature = feature; bind.mListViewItm = item; item.Tag = bind; if (cmp.GetFirstFileId() == currentProject.mainTargetApp) { item.ImageIndex = 1; // Main target } fileList.Items.Add(item); } } }
private void ReloadDirectories() { featureDirectoryList.Items.Clear(); directoryProperties.SelectedObject = null; if (featuresTree.SelectedNode != null) { SetupFeature current = (SetupFeature)featuresTree.SelectedNode.Tag; foreach (SetupDirectory dir in current.directories) { ListViewItem item = new ListViewItem(dir.dstPath); item.SubItems.Add(dir.srcPath); item.Tag = dir; featureDirectoryList.Items.Add(item); } if (featureDirectoryList.Items.Count > 0) { featureDirectoryList.Items[0].Selected = true; } } }
private XmlElement GenerateComponent(SetupComponent component, SetupFeature feature, XmlElement feature_node) { // Make the reference from Feature XmlElement component_ref = doc.CreateElement("ComponentRef"); component_ref.SetAttribute("Id", component.componentId); feature_node.AppendChild(component_ref); // Make the actual component and file XmlElement component_node = doc.CreateElement("Component"); component_node.SetAttribute("Id", component.componentId); component_node.SetAttribute("Guid", component.componentGuid); if (component.addToCreateFolder) { XmlElement node = doc.CreateElement("CreateFolder"); component_node.AppendChild(node); } // Link the component to the appropriate directory string target_dir_name = component.targetDirectory; // Not accessible from the UI. We use the file.dstPath in stead. // Now, lets see if the file overrides the default target. We only have one file // for each component (unless the older i sscanned, in wich case the dstPath in the // file is guaranteed to be empty if ((component.componentFiles.Count == 1) && ("" != component.componentFiles[0].dstPath)) { target_dir_name = component.componentFiles[0].dstPath; } if ((null == target_dir_name) || ("" == target_dir_name)) { target_dir_name = GetDefaultDir(feature); if ((null == target_dir_name) || ("" == target_dir_name)) target_dir_name = "[APPLICATIONFOLDER]"; else target_dir_name = "[" + target_dir_name + "]"; } TargetDir target_dir = GetDirectoryNode(target_dir_name, null); target_dir.mXmlNode.AppendChild(component_node); // Path if ((null != component.pathEntry) && ("" != component.pathEntry)) { XmlElement path_node = doc.CreateElement("Environment"); path_node.SetAttribute("Id", GetUniqueId()); path_node.SetAttribute("Name", "PATH"); path_node.SetAttribute("Action", "set"); path_node.SetAttribute("System", "yes"); path_node.SetAttribute("Part", "last"); path_node.SetAttribute("Value", component.pathEntry); component_node.AppendChild(path_node); } foreach (SetupFile file in component.componentFiles) { XmlElement file_node = doc.CreateElement("File"); file_node.SetAttribute("Id", file.fileId); string src_path = Path.Combine(file.srcDirectory, file.srcName); file_node.SetAttribute("Source", src_path); if (!isMergeModle) file_node.SetAttribute("DiskId", GetMedia(src_path).ToString()); SetNameAttribute(file_node, file.dstName); if (file.ExecuteOnInstall) { AddExecuteOnInstall(file); } /* TODO: Create a dedicated component for user-shortcuts (for each file) * to avoid the "ICE57: Component 'IDC5A7B8F2554B02E5FC9D5ED7E684B285' * has both per-user and per-machine data with a per-machine KeyPath." * warning. */ //if (file.shortcutInProgramFilesMenu) // file_node.AppendChild(AddShortcut(file, my_program_menu, "pf")); //if (file.shortcutInQuickLaunch) // file_node.AppendChild(AddShortcut(file, quicklaunch, "ql")); //if (file.shortcutOnDesktop) // file_node.AppendChild(AddShortcut(file, desktop, "dt")); if (file.shortcutInProgramFilesMenu) AddShortcut(file, feature_node, my_program_menu, target_dir.mXmlNode); if (file.shortcutInQuickLaunch) AddShortcut(file, feature_node, quicklaunch, target_dir.mXmlNode); if (file.shortcutOnDesktop) AddShortcut(file, feature_node, desktop, target_dir.mXmlNode); if (file.shortcutInStartupFolder) AddShortcut(file, feature_node, my_start_menu, target_dir.mXmlNode); if (file.isTrueTypeFont) { file_node.SetAttribute("TrueType", "yes"); //if ((file.dstPath == null) || (file.dstPath == "")) } if (file.isComModule) { XmlElement typelib = doc.CreateElement("TypeLib"); typelib.SetAttribute("Id", file.typelibGuid); typelib.SetAttribute("Language", "0"); typelib.SetAttribute("Advertise", "yes"); // Just to avoid manual version mess file_node.AppendChild(typelib); if ((file.typelibGuid == null) || (file.typelibGuid == "")) { throw new ApplicationException( "The COM/Typelib file \"" + file.srcName + "\" is missing a GUID. This must be specifield."); } } if (file.service.isService) { XmlElement svc = doc.CreateElement("ServiceInstall"); component_node.AppendChild(svc); svc.SetAttribute("Id", file.service.id); if ("" != file.service.userAccount) svc.SetAttribute("Account", file.service.userAccount); if ("" != file.service.userPassword) svc.SetAttribute("Password", file.service.userPassword); if ("" != file.service.cmdLineArguments) svc.SetAttribute("Arguments", file.service.cmdLineArguments); if ("" != file.service.description) svc.SetAttribute("Description", file.service.description); svc.SetAttribute("ErrorControl", file.service.errorControl.ToString()); svc.SetAttribute("Interactive", file.service.interactive ? "yes" : "no"); if ("" != file.service.loadOrderGroup) svc.SetAttribute("LoadOrderGroup", file.service.loadOrderGroup); svc.SetAttribute("Name", file.service.serviceName); svc.SetAttribute("Start", file.service.startMode.ToString()); svc.SetAttribute("Type", "ownProcess"); svc.SetAttribute("Vital", file.service.vital ? "yes" : "no"); XmlElement svc_ctl = doc.CreateElement("ServiceControl"); component_node.AppendChild(svc_ctl); svc_ctl.SetAttribute("Id", file.service.id); svc_ctl.SetAttribute("Name", file.service.serviceName); svc_ctl.SetAttribute("Remove", file.service.Remove.ToString()); if (file.service.StartWhenInstalled) svc_ctl.SetAttribute("Start", "install"); } foreach (FileExtension ext in file.fileExtensions) { XmlElement prog_id_node = doc.CreateElement("ProgId"); prog_id_node.SetAttribute("Id", ext.Id); prog_id_node.SetAttribute("Description", ext.Description); prog_id_node.SetAttribute("Icon", file.fileId); prog_id_node.SetAttribute("IconIndex", ext.IconIndex.ToString()); component_node.AppendChild(prog_id_node); XmlElement ext_node = doc.CreateElement("Extension"); ext_node.SetAttribute("Id", ext.Extension); ext_node.SetAttribute("ContentType", ext.MimeType); prog_id_node.AppendChild(ext_node); XmlElement verb_node = doc.CreateElement("Verb"); verb_node.SetAttribute("Id", "Open"); verb_node.SetAttribute("Command", "Open"); verb_node.SetAttribute("TargetFile", file.fileId); verb_node.SetAttribute("Argument", "\"%1\""); // BUG 1944386 FIXED ext_node.AppendChild(verb_node); } component_node.AppendChild(file_node); } return component_node; }
private void GenerateFeature(SetupFeature feature, XmlElement parent) { if (feature.excludeFromBuild) return; XmlElement node = doc.CreateElement("Feature"); if (null == parent) { // Root if (!isMergeModle) product.AppendChild(node); features_root = node; } else { parent.AppendChild(node); } node.SetAttribute("Id", feature.featureId); node.SetAttribute("Title", feature.featureName); node.SetAttribute("Level", feature.installLevel.ToString()); node.SetAttribute("Description", feature.featureDescription); string install_mode = null; switch ((SetupFeature.InstallModeE)feature.defaultInstallMode) { case SetupFeature.InstallModeE.INSTALL_LOCALLY: install_mode = "local"; break; case SetupFeature.InstallModeE.RUN_FROM_SOURCE: install_mode = "source"; break; case SetupFeature.InstallModeE.SAME_AS_PARENT_FEATURE: install_mode = "followParent"; break; } // Handle configurable directories for the feature // Add the dir for this node. if ((null != feature.configurableDirectory) && ("" != feature.configurableDirectory) && ("APPLICATIONFOLDER" != feature.configurableDirectory)) { GetDirectoryNode(feature.configurableDirectoryDefaultPath, feature.configurableDirectory); } // Generate the components (and files) for the directories List<SetupComponent> dir_components = new List<SetupComponent>(); foreach (SetupDirectory dir in feature.directories) { // Make the Directory-node if it don't exist GetDirectoryNode(dir.dstPath, dir.dirId); // Make components under the dir dir.MakeComponents(dir_components, dir.srcPath, dir.dstPath); if (dir.addToPath) { dir.pathComponent.pathEntry = "[" + GetDirectoryNode(dir.dstPath, null).mXmlNode.GetAttribute("Id") + "]"; dir_components.Add(dir.pathComponent); } else dir.pathComponent.pathEntry = null; // Visual Studio Integration if (dir.ideMicrosoftVisualStudio2003) MakeVcIntegration("Microsoft Visual Studio 2003", dir, feature, node); if (dir.ideMicrosoftVisualStudio2005) MakeVcIntegration("Microsoft Visual Studio 2005", dir, feature, node); } if (install_mode != null) node.SetAttribute("InstallDefault", install_mode); if ((feature.configurableDirectory != null) && ("" != feature.configurableDirectory)) node.SetAttribute("ConfigurableDirectory", feature.configurableDirectory); foreach (SetupComponent component in feature.components) GenerateComponent(component, feature, node); foreach (SetupComponent component in dir_components) GenerateComponent(component, feature, node); { //XmlElement my_component = GenerateComponent(feature.component, node); // Add shortcuts foreach (SetupShortcut shortcut in feature.shortcuts) { AddShortcut(shortcut, feature, null, null); if (shortcut.showOnDesktop) AddShortcut(shortcut, feature, desktop.GetAttribute("Id"), "dt"); if (shortcut.showOnProgramMenu) AddShortcut(shortcut, feature, my_program_menu.GetAttribute("Id"), "pf"); if (shortcut.showOnQuickLaunchBar) AddShortcut(shortcut, feature, quicklaunch.GetAttribute("Id"), "ql"); } } GenerateFeature(feature.childFeatures, node); return; }
private string GetDefaultDir(SetupFeature feature) { if ((null != feature.configurableDirectory) && ("" != feature.configurableDirectory)) return feature.configurableDirectory; // try parent SetupFeature parent = GetParentFeature(feature, null, projectFeatures); if (null != parent) return GetDefaultDir(parent); return null; // No luck }
// Find the parent node of feature. // Since we have no "parent" property, we have to start a recursive scan from // the projects feature-list private SetupFeature GetParentFeature(SetupFeature feature, SetupFeature parent, List<SetupFeature> parentList) { // Scan down foreach (SetupFeature child in parentList) { if (child.featureId == feature.featureId) return parent; SetupFeature probe = GetParentFeature(feature, child, child.childFeatures); if (null != probe) return probe; } return null; }
private void MakeVcIntegration(string ideName, SetupDirectory dir, SetupFeature feature, XmlElement featureNode) { string ide_version = ""; string feature_option = ""; switch (ideName) { case "Microsoft Visual Studio 2003": ide_version = "7.1"; feature_option = projectProperties.VS2003Integration; break; case "Microsoft Visual Studio 2005": ide_version = "8.0"; feature_option = projectProperties.VS2005Integration; break; } // Must modify C:\Documents and Settings\jgaa\Local Settings\Application Data\Microsoft\VisualStudio\7.1\VCComponents.dat #if DEBUG XmlElement bin = GetBinDll(Path.Combine(Path.Combine(Shell.warSetupResPath, "CustomActions"), "WarSetupPluginD.dll")); #else XmlElement bin = GetBinDll(Path.Combine(Path.Combine(Shell.warSetupResPath, "CustomActions"), "WarSetupPlugin.dll")); #endif string ini_path = @"[LocalAppDataFolder]Microsoft\VisualStudio\" + ide_version + @"\VCComponents.dat"; SetPropertyValue("VCCOMPONENTSFILEPATH", ini_path); string prop_key = MakeVcFileCond(ini_path, null); SetPropertyValue("VC_VERSION", ideName); string feature_cond_install = ""; if ((null != feature_option) && ("" != feature_option)) { // make a rule that only activates the integration i fa feature with Id feature_option is enabled feature_cond_install = " AND (&" + feature_option + "=3) "; //feature_cond_uninstall = " OR (&feature_option=2) "; } // TODO: Add CustomAction to abort installation if the feature is enabled and // the VCComponents.dat file is missing. { XmlElement abort = doc.CreateElement("CustomAction"); abort.SetAttribute("Id", GetUniqueId().ToUpper()); abort.SetAttribute("Error", "The required file " + ini_path + " is missing. " + ideName + " must be installed, and you must have entered the " + "Tools/Options menu and selected Projects/C++ Directories " + "at least once (That's when this file is created)."); product.AppendChild(abort); AddExecuteSequence(abort.GetAttribute("Id"), "(NOT " + prop_key + ") AND (&" + featureNode.GetAttribute("Id") + "=3)" + feature_cond_install); } if (dir.ideExecutables) MakeVcIntegrationPath(bin, "VCCOMPONENTSFILEEXECDIR", dir.dstPath, featureNode, prop_key, feature_option); if (dir.ideHeaderFiles) MakeVcIntegrationPath(bin, "VCCOMPONENTSFILEHEADERDIR", dir.dstPath, featureNode, prop_key, feature_option); if (dir.ideLibrary) MakeVcIntegrationPath(bin, "VCCOMPONENTSFILELIBDIR", dir.dstPath, featureNode, prop_key, feature_option); }
public void InitializeDefaults() { SetupFeature features = new WarSetup.SetupFeature(); features.featureName = ""; features.featureDescription = "The complete package"; features.configurableDirectory = "APPLICATIONFOLDER"; features.configurableDirectoryDefaultPath = "[ProjectName]"; features.defaultInstallMode = (int)SetupFeature.InstallModeE.INSTALL_LOCALLY; { SetupFeature program_feature = new SetupFeature(); program_feature.featureName = "Program"; program_feature.featureDescription = "The Main Executable"; program_feature.featureId = "PROGRAM"; program_feature.defaultInstallMode = (int)SetupFeature.InstallModeE.INSTALL_LOCALLY; features.childFeatures.Add(program_feature); } { SetupFeature program_feature = new SetupFeature(); program_feature.featureName = "Documentation"; program_feature.featureDescription = "The documentation"; program_feature.featureId = "DOCUMENTATION"; program_feature.defaultInstallMode = (int)SetupFeature.InstallModeE.INSTALL_LOCALLY; features.childFeatures.Add(program_feature); } _projectFeatures.Add(features); projectProperties.AddAllUiCulture(); }
private XmlElement AddShortcut(SetupShortcut shortcut, SetupFeature feature, string directoryId, string shortcutType) { XmlElement sc_node = doc.CreateElement("Shortcut"); if (null == shortcutType) { sc_node.SetAttribute("Id", shortcut.shortcutId); } else { sc_node.SetAttribute("Id", shortcutType + "_" + shortcut.shortcutId); } if ((null != shortcut.commandArguments) && ("" != shortcut.commandArguments)) sc_node.SetAttribute("Arguments", shortcut.commandArguments); sc_node.SetAttribute("Description", shortcut.description); if (null == directoryId) { sc_node.SetAttribute("Directory", GetDirectoryNode( Path.GetDirectoryName(shortcut.dstPath), null).mXmlNode.GetAttribute("Id")); } else { sc_node.SetAttribute("Directory", directoryId); } sc_node.SetAttribute("Name", Path.GetFileName(shortcut.dstPath)); if ((null != shortcut.workingDir) && ("" != shortcut.workingDir)) { TargetDir dir = GetDirectoryNode(shortcut.workingDir, null); string id = dir.mXmlNode.GetAttribute("Id"); sc_node.SetAttribute("WorkingDirectory", id); } XmlElement target_dir = GetDirectoryNode(Path.GetDirectoryName(shortcut.srcPath), null).mXmlNode; XmlElement target_node = null; string target_name = Path.GetFileName(shortcut.srcPath); // Scan the target-dir for a directory with the target-name foreach (XmlNode xml_node in target_dir.ChildNodes) { if ((xml_node.NodeType == XmlNodeType.Element) && (xml_node.Name == "Directory")) { XmlElement subdir = (XmlElement)xml_node; string name = subdir.GetAttribute("Name"); if (name == target_name) { target_node = subdir; break; } } } // Scan the dir for a file with the target_name if (null == target_node) { foreach (XmlNode xml_node in target_dir.GetElementsByTagName("File")) { XmlElement file = (XmlElement)xml_node; string name = file.GetAttribute("Name"); if (name == target_name) { target_node = file; break; } } } if (null == target_node) { throw new ApplicationException( "The shortcut \"" + shortcut.dstPath + "\" in feature \"" + feature.featureName + "\" does not resolve.\r\n" + "I cannot find any file or directory on the target system " + "with the path \"" + shortcut.srcPath + "\"."); } //sc_node.SetAttribute("Target", "[" + target_node.GetAttribute("Id") + "]"); target_node.AppendChild(sc_node); return sc_node; }