/// <summary> /// Creates the new launch condition with the given values /// </summary> public override void Execute() { try { IVsdDeployable deployable = (IVsdDeployable)SetupProject.Object; IVsdCollectionSubset plugins = deployable.GetPlugIns(); IVsdLaunchConditionPlugIn launchConditionPlugin = plugins.Item("LaunchCondition") as IVsdLaunchConditionPlugIn; if (launchConditionPlugin != null) { vsdLaunchCondition = (IVsdLaunchCondition)DteHelper.CoCreateInstance( this.Site, typeof(VsdLaunchConditionClass), typeof(IVsdLaunchCondition)); vsdLaunchCondition.Name = this.LaunchConditionName; vsdLaunchCondition.Condition = this.Condition; vsdLaunchCondition.Message = this.Message; vsdLaunchCondition.InstallUrl = this.InstallUrl; launchConditionPlugin.Items.Add(vsdLaunchCondition); } } catch (Exception) { vsdLaunchCondition = null; throw; } }
/// <summary> /// Adds the new folder to the setup project /// with the given parameters /// </summary> public override void Execute() { try { IVsdDeployable deployable = (IVsdDeployable)SetupProject.Object; IVsdCollectionSubset plugins = deployable.GetPlugIns(); IVsdFolderPlugIn folderPlugin = plugins.Item("Folder") as IVsdFolderPlugIn; if (folderPlugin != null) { vsdFolder = (IVsdCustomFolder)DteHelper.CoCreateInstance( this.Site, typeof(VsdCustomFolderClass), typeof(IVsdCustomFolder)); vsdFolder.Name = FolderName; vsdFolder.Property_2 = this.Property; vsdFolder.DefaultLocation = this.DefaultLocation; folderPlugin.Items.Add(vsdFolder); } } catch (Exception) { vsdFolder = null; throw; } }
/// <summary> /// Creates the new registry locator /// </summary> public override void Execute() { try { IVsdDeployable deployable = (IVsdDeployable)SetupProject.Object; IVsdCollectionSubset plugins = deployable.GetPlugIns(); IVsdLocatorPlugIn locatorPlugin = plugins.Item("Locator") as IVsdLocatorPlugIn; if (locatorPlugin != null) { vsdLocator = (IVsdRegistryKeyLocator)DteHelper.CoCreateInstance( this.Site, typeof(VsdRegistryKeyLocatorClass), typeof(IVsdRegistryKeyLocator)); vsdLocator.Name = this.LocatorName; vsdLocator.Property = this.Property; vsdLocator.RegKey = this.RegistryKey; vsdLocator.Root = vsdRegistryRoot.vsdrrHKLM; vsdLocator.Value = this.Value; locatorPlugin.Items.Add(vsdLocator); } } catch (Exception) { vsdLocator = null; throw; } }
/// <summary> /// Adds the new output from the specified parameters /// </summary> public override void Execute() { IVsdDeployable deployable = (IVsdDeployable)SetupProject.Object; IVsdProject project = (IVsdProject)deployable.GetParent(); if (Folder == null) { project.AddOutputGroup(ProjectOutputKind, InputProject.UniqueName); } else // Folder is not null, so let's add it manually { IVsdCollectionSubset plugins = deployable.GetPlugIns(); IVsdProjectOutputPlugIn projectsPlugin = plugins.Item("ProjectOutput") as IVsdProjectOutputPlugIn; projectOutput = (IVsdProjectOutputGroup)DteHelper.CoCreateInstance( this.Site, typeof(VsdProjectOutputGroupClass), typeof(IVsdProjectOutputGroup)); //projectOutput.OutputConfig = null; projectOutput.OutputGroup = ProjectOutputKind; projectOutput.OutputProject = InputProject.UniqueName; projectOutput.ShowKeyOutput = true; projectOutput.Folder = vsdFolder; projectsPlugin.Items.Add(projectOutput); } // Collapse to project definition. UIHierarchyItem uiitem = DteHelper.SelectItem(SetupProject.DTE, DteHelper.BuildPath(SetupProject)); if (uiitem != null) { uiitem.UIHierarchyItems.Expanded = false; } }
/// <summary> /// Creates the new custom action with the given parameters /// </summary> public override void Execute() { try { IVsdDeployable deployable = (IVsdDeployable)SetupProject.Object; IVsdCollectionSubset plugins = deployable.GetPlugIns(); IVsdCustomActionPlugIn customActionPlugin = plugins.Item("CustomAction") as IVsdCustomActionPlugIn; if (customActionPlugin != null) { customAction = (IVsdCustomAction)DteHelper.CoCreateInstance( this.Site, typeof(VsdCustomActionClass), typeof(IVsdCustomAction)); customAction.Name = this.ActionName; customAction.InstallerClass = true; customAction.Object = this.Assembly; customAction.FileType = vsdCustomActionFileTypes.vsdcaDll; if (InstallAction.Equals("Install")) { customAction.InstallAction = vsdCustomActionInstallActions.vsdcaInstall; } else if (InstallAction.Equals("Uninstall")) { customAction.InstallAction = vsdCustomActionInstallActions.vsdcaUninstall; } else if (InstallAction.Equals("Commit")) { customAction.InstallAction = vsdCustomActionInstallActions.vsdcaCommit; } else if (InstallAction.Equals("Rollback")) { customAction.InstallAction = vsdCustomActionInstallActions.vsdcaRollback; } else { throw new InvalidOperationException( String.Format(CultureInfo.CurrentCulture, Properties.Resources.AddCustomAction_InvalidInstallAction, InstallAction)); } customAction.CustomActionData = this.CustomActionData; customActionPlugin.Items.Add(customAction); } } catch (Exception) { if (CustomAction != null) { CustomAction = null; } throw; } }
private void AddSimpleFile() { IVsdDeployable deployable = (IVsdDeployable)SetupProject.Object; IVsdProject project = (IVsdProject)deployable.GetParent(); IVsdCollectionSubset plugins = deployable.GetPlugIns(); IVsdFilePlugIn filePlugin = plugins.Item("File") as IVsdFilePlugIn; IVsdFile vsdFile = (IVsdFile)DteHelper.CoCreateInstance( this.Site, typeof(VsdFileClass), typeof(IVsdFile)); vsdFile.TargetName = Path.GetFileName(this.InputFileName); vsdFile.SourcePath = this.InputFileName; vsdFile.Folder = this.vsdFolder; filePlugin.Items.Add(vsdFile); file = vsdFile; }
private void AddMergeModule() { IVsdDeployable deployable = (IVsdDeployable)SetupProject.Object; IVsdProject project = (IVsdProject)deployable.GetParent(); IVsdCollectionSubset plugins = deployable.GetPlugIns(); IVsdMergeModulePlugIn modulePlugin = plugins.Item("MergeModule") as IVsdMergeModulePlugIn; IVsdModule vsdModule = (IVsdModule)DteHelper.CoCreateInstance( this.Site, typeof(VsdModuleClass), typeof(IVsdModule)); vsdModule.UseDynamicProperties = true; vsdModule.SourcePath = this.InputFileName; vsdModule.Folder = this.vsdFolder; modulePlugin.Items.Add(vsdModule); file = vsdModule; }