/// <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 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;
            }
        }
Example #3
0
 /// <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;
     }
 }
Example #4
0
 /// <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;
     }
 }
        private void DisableUIInstallAllUsers(bool InstallAllUsers)
        {
            IVsdDeployable          deployable = (IVsdDeployable)SetupProject.Object;
            IVsdCollectionSubset    plugins    = deployable.GetPlugIns();
            IVsdUserInterfacePlugIn uiPlugin   = plugins.Item("UserInterface") as IVsdUserInterfacePlugIn;

            if (uiPlugin != null)
            {
                foreach (object objectFile in uiPlugin.Items)
                {
                    if (objectFile is IVsdDialogModuleGroup)
                    {
                        IVsdDialogModuleGroup uiModuleGroup = objectFile as IVsdDialogModuleGroup;
                        foreach (object dialogObject in uiModuleGroup.Dialogs)
                        {
                            if (dialogObject is IVsdDialogModule)
                            {
                                ChangeInstallAllUsersUI(dialogObject as IVsdDialogModule);
                            }
                        }
                    }
                    else if (objectFile is IVsdDialogModule)
                    {
                        ChangeInstallAllUsersUI(objectFile as IVsdDialogModule);
                    }
                }
            }
        }
Example #6
0
        private void DeleteMergeModule()
        {
            IVsdDeployable        deployable   = (IVsdDeployable)SetupProject.Object;
            IVsdProject           project      = (IVsdProject)deployable.GetParent();
            IVsdCollectionSubset  plugins      = deployable.GetPlugIns();
            IVsdMergeModulePlugIn modulePlugin = plugins.Item("MergeModule") as IVsdMergeModulePlugIn;

            modulePlugin.Items.RemoveObject(File);
            File = null;
        }
Example #7
0
 /// <summary>
 /// Removes the custom action created by the execution
 /// of the action
 /// </summary>
 public override void Undo()
 {
     if (customAction != null)
     {
         IVsdDeployable         deployable         = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset   plugins            = deployable.GetPlugIns();
         IVsdCustomActionPlugIn customActionPlugin = plugins.Item("CustomAction") as IVsdCustomActionPlugIn;
         customActionPlugin.Items.RemoveObject(customAction);
         customAction = null;
     }
 }
 /// <summary>
 /// Removes the project output that was recently added
 /// </summary>
 public override void Undo()
 {
     if (projectOutput != null)
     {
         IVsdDeployable          deployable     = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset    plugins        = deployable.GetPlugIns();
         IVsdProjectOutputPlugIn projectsPlugin = plugins.Item("ProjectOutput") as IVsdProjectOutputPlugIn;
         projectsPlugin.Items.RemoveObject(projectOutput);
         projectOutput = null;
     }
 }
Example #9
0
 /// <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;
     }
 }
Example #10
0
 /// <summary>
 /// Removes the folder that was created by the
 /// execution of the action
 /// </summary>
 public override void Undo()
 {
     if (vsdFolder != null)
     {
         IVsdDeployable       deployable   = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset plugins      = deployable.GetPlugIns();
         IVsdFolderPlugIn     folderPlugin = plugins.Item("Folder") as IVsdFolderPlugIn;
         if (folderPlugin != null)
         {
             folderPlugin.Items.RemoveObject(vsdFolder);
             vsdFolder = null;
         }
     }
 }
 /// <summary>
 /// Removes the launch condition recently added
 /// </summary>
 public override void Undo()
 {
     if (vsdLaunchCondition != null)
     {
         IVsdDeployable            deployable            = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset      plugins               = deployable.GetPlugIns();
         IVsdLaunchConditionPlugIn launchConditionPlugin = plugins.Item("LaunchCondition") as IVsdLaunchConditionPlugIn;
         if (launchConditionPlugin != null)
         {
             launchConditionPlugin.Items.RemoveObject(vsdLaunchCondition);
             vsdLaunchCondition = null;
         }
     }
 }
Example #12
0
 /// <summary>
 /// Removes the locator that was recently created
 /// </summary>
 public override void Undo()
 {
     if (vsdLocator != null)
     {
         IVsdDeployable       deployable    = (IVsdDeployable)SetupProject.Object;
         IVsdCollectionSubset plugins       = deployable.GetPlugIns();
         IVsdLocatorPlugIn    locatorPlugin = plugins.Item("Locator") as IVsdLocatorPlugIn;
         if (locatorPlugin != null)
         {
             locatorPlugin.Items.RemoveObject(vsdLocator);
             vsdLocator = null;
         }
     }
 }
Example #13
0
        private bool ExcludeProject(IVsdCollectionSubset plugins)
        {
            bool result = false;

            if (ExcludeMergeModules((plugins.Item("MergeModule") as IVsdMergeModulePlugIn).Items))
            {
                result = true;
            }
            if (ExcludeFiles((plugins.Item("File") as IVsdFilePlugIn).Items))
            {
                result = true;
            }
            return(result);
        }
        /// <summary>
        /// Performs the action of the changing of the properties to the project
        /// </summary>
        public override void Execute()
        {
            IVsdDeployable       deployable    = (IVsdDeployable)SetupProject.Object;
            IVsdCollectionSubset plugins       = deployable.GetPlugIns();
            IVsdProductPlugIn    productPlugin = plugins.Item("Product") as IVsdProductPlugIn;

            if (productPlugin != null)
            {
                bool oldValue = productPlugin.InstallAllUsers;
                productPlugin.InstallAllUsers = InstallAllUsers;
                productPlugin.Manufacturer    = Author;
                productPlugin.Author          = Author;
                productPlugin.Description     = Description;
                DisableUIInstallAllUsers(InstallAllUsers);
                InstallAllUsers = oldValue;
            }
        }
Example #15
0
        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;
        }
Example #16
0
        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;
        }
Example #17
0
        /// <summary>
        /// Performs the exclusion / or inclusion of the dependencies
        /// </summary>
        /// <param name="exclude"></param>
        private void Execute(bool exclude)
        {
            IVsdDeployable       deployable = (IVsdDeployable)SetupProject.Object;
            IVsdCollectionSubset plugins    = deployable.GetPlugIns();
            IVsdFilePlugIn       filePlugin = plugins.Item("File") as IVsdFilePlugIn;

            if (filePlugin != null)
            {
                foreach (object fileObject in filePlugin.Items)
                {
                    if (fileObject is IVsdFile)
                    {
                        if (((IVsdFile)fileObject).IsDependency)
                        {
                            ((IVsdFile)fileObject).Exclude = exclude;
                        }
                    }
                    else if (fileObject is IVsdAssembly)
                    {
                        if (((IVsdAssembly)fileObject).IsDependency)
                        {
                            ((IVsdAssembly)fileObject).Exclude = exclude;
                        }
                    }
                }
            }
            IVsdMergeModulePlugIn modulePlugin = plugins.Item("MergeModule") as IVsdMergeModulePlugIn;

            if (modulePlugin != null)
            {
                foreach (object moduleObject in modulePlugin.Items)
                {
                    if (moduleObject is IVsdModule)
                    {
                        if (((IVsdModule)moduleObject).IsDependency)
                        {
                            ((IVsdModule)moduleObject).Exclude = exclude;
                        }
                    }
                }
            }
        }