none
MSI Installer project remove disk cost and change text RRS feed

  • Question

  • Hi 

    I can't quite seem to find the correct forum for this ....

    I have created a very simple VS2019 MSI Installer project

    I would like to

    1) Remove the Disk Cost button

    2) Change the text that says "Install xxxx for yourself, or anyone who uses this computer"

    I can't see properties for these in the UI editor

    Thanks in advance


    Thursday, November 7, 2019 1:39 PM

Answers

  • Thanks for your example

    Any chance you could do me an example for these two things ?

    1) Remove the Disk Cost button

    2) Change the text that says "Install xxxx for yourself, or anyone who uses this computer"


    The following script when run as a post-build event will disable and hide the DiskCost button and change the text as shown in the image that I posted earlier -

    // HideButtonChangeText.js <msi-file>
    // Performs a post-build fixup of an msi to hide the DiskCost button and change dialog text
    
    
    // Constant values from Windows Installer
    var msiOpenDatabaseModeTransact = 1;
    var msiViewModifyReplace        = 4
    
    
    if (WScript.Arguments.Length != 1)
    {
    	WScript.StdErr.WriteLine(WScript.ScriptName + " file");
    	WScript.Quit(1);
    }
    
    var filespec = WScript.Arguments(0);
    var installer = WScript.CreateObject("WindowsInstaller.Installer");
    var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);
    
    var sql
    var view
    var record
    
    try
    {
    	WScript.Echo("Updating the Control table...");
    	// Hide the DiskCost button 
    	sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FolderForm' AND `Control`='DiskCostButton'";
    	view = database.OpenView(sql);
    	view.Execute();
    	record = view.Fetch();
    	record.IntegerData(8) = 0;
    	view.Modify(msiViewModifyReplace, record);
    	view.Close();
    
    	// Modify the text 
    	sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FolderForm' AND `Control`='AllUsersText'";
    	view = database.OpenView(sql);
    	view.Execute();
    	record = view.Fetch();
    	record.StringData(10) = "{\\VSI_MS_Shell_Dlg13.0_0_0}Install [ProductName] See radio buttons below to choose how:";
    	view.Modify(msiViewModifyReplace, record);
    	view.Close();
    
    	database.Commit();
    }
    catch(e)
    {
    	WScript.StdErr.WriteLine(e);
    	WScript.Quit(1);
    }
    

    • Marked as answer by Minieggs1999 Monday, November 25, 2019 12:44 PM
    Monday, November 25, 2019 12:04 PM

All replies

  • Hi minieggs1999,

    Welcome to MSDN forum.

    For your requirements, I'm sorry that they are by designed and there are not appropriate methods to modify them. 

    We recommend you could post them to Q&A under this download page, then developers would get back to you as soon as possible.

    Thank you for understanding.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, November 8, 2019 3:01 AM
  • Hi Minieggs1999,

    Sorry to disturb you.

    I have found some official documents, they are old but maybe helpful for you to do some modifications and you could refer to them.

    How to: Add and Remove Installation Dialog Boxes in the User Interface Editor

    Installation Dialog Box Restrictions

    Not sure if this could work, you could add some dialogs specified and remove some of them that you don’t want from right-click your project -> View -> User Interface -> for example right-click Start and choose Add Dialog/right-click Welcome -> Delete. And you could choose the specified type of Dialog if you want.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 22, 2019 9:54 AM
  • For an msi created by Visual Studio Installer extensions you can use Orca or a post-build event to edit the FolderForm dialog.  In the Control table for the FolderForm dialog change the attribute for the DiskCost button from 3 to 0.  The button will be disabled and not visible.  You can also change the text by editing the AllUsersText control n the same table.  Depending on your changes, you may also need to change the dimensions of the control.

    For example, note that Disk Cost is not visible and the text has been changed -


    • Edited by RLWA32 Friday, November 22, 2019 2:09 PM
    Friday, November 22, 2019 2:08 PM
  • Thanks both

    I discovered the Orca option not long after posting and that seems to have worked in a limited way

    Thanks again

    Friday, November 22, 2019 4:03 PM
  • Thanks both

    I discovered the Orca option not long after posting and that seems to have worked in a limited way

    Thanks again

    You're welcome.

    What do you mean by "limited way"?

    Friday, November 22, 2019 4:55 PM
  • I mean I have removed the button and changed the text as I wanted to but I have not gone through and resized the dialog as it just looks way too fiddly using the Orca method
    Friday, November 22, 2019 5:05 PM
  • You can use script in a post-build event to make your desired changes to the msi created by the VS Installer project.

    This is much more convenient than using Orca.

    For an example of using script in a post-build event, see my comments in https://social.msdn.microsoft.com/Forums/en-US/b02484c0-e366-443b-9ba2-26c080a5c3b6/correct-conditions-typing-in-visual-studio-installer-setup-and-deployment-2017?forum=winformssetup

    Saturday, November 23, 2019 10:59 AM
  • Thanks for your example

    Any chance you could do me an example for these two things ?

    1) Remove the Disk Cost button

    2) Change the text that says "Install xxxx for yourself, or anyone who uses this computer"


    Monday, November 25, 2019 9:42 AM
  • Thanks for your example

    Any chance you could do me an example for these two things ?

    1) Remove the Disk Cost button

    2) Change the text that says "Install xxxx for yourself, or anyone who uses this computer"


    The following script when run as a post-build event will disable and hide the DiskCost button and change the text as shown in the image that I posted earlier -

    // HideButtonChangeText.js <msi-file>
    // Performs a post-build fixup of an msi to hide the DiskCost button and change dialog text
    
    
    // Constant values from Windows Installer
    var msiOpenDatabaseModeTransact = 1;
    var msiViewModifyReplace        = 4
    
    
    if (WScript.Arguments.Length != 1)
    {
    	WScript.StdErr.WriteLine(WScript.ScriptName + " file");
    	WScript.Quit(1);
    }
    
    var filespec = WScript.Arguments(0);
    var installer = WScript.CreateObject("WindowsInstaller.Installer");
    var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);
    
    var sql
    var view
    var record
    
    try
    {
    	WScript.Echo("Updating the Control table...");
    	// Hide the DiskCost button 
    	sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FolderForm' AND `Control`='DiskCostButton'";
    	view = database.OpenView(sql);
    	view.Execute();
    	record = view.Fetch();
    	record.IntegerData(8) = 0;
    	view.Modify(msiViewModifyReplace, record);
    	view.Close();
    
    	// Modify the text 
    	sql = "SELECT `Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Property`, `Text`, `Control_Next`, `Help` FROM `Control` WHERE `Dialog_`='FolderForm' AND `Control`='AllUsersText'";
    	view = database.OpenView(sql);
    	view.Execute();
    	record = view.Fetch();
    	record.StringData(10) = "{\\VSI_MS_Shell_Dlg13.0_0_0}Install [ProductName] See radio buttons below to choose how:";
    	view.Modify(msiViewModifyReplace, record);
    	view.Close();
    
    	database.Commit();
    }
    catch(e)
    {
    	WScript.StdErr.WriteLine(e);
    	WScript.Quit(1);
    }
    

    • Marked as answer by Minieggs1999 Monday, November 25, 2019 12:44 PM
    Monday, November 25, 2019 12:04 PM
  • Thanks VERY much

    That is extremely generous of you

    It works well

    One question

    Did you only select the FolderForm and not also the AdminFolderForm for a particular reason ? I assume I would just copy the blocks of code if I also wanted to change this one too ?

    Thanks again

    Monday, November 25, 2019 12:43 PM
  • Don't forget that it's just a sample of how to use script to modify an msi file.

    I didn't give any thought to an ordinary vs. Administrative installation.

    Monday, November 25, 2019 1:08 PM