Update Binary File in WIX Installation using Custom Action RRS feed

  • Question

  • Hi

    I am developing a WIX Installer for creating a  SQL database . In this I need to update the SQL script file for replacing some text .

    I am using custom action to read the Binary file text. Able to read the text from the Binary file and replace the string using the below code:


      View v = session.Database.OpenView("SELECT `Data` FROM `Binary` WHERE `Name` = '{0}'", binaryKeyName);
                    Record r = v.Fetch();

                    StreamReader reader = new StreamReader(r.GetStream("Data"));
                    var text = reader.ReadToEnd();
                    text = text.Replace(textTobereplaced, ReplacedText);

                    byte[] byteArray = Encoding.ASCII.GetBytes(text);
                    MemoryStream stream = new MemoryStream(byteArray);
                    if (r != null) r.Close();
                    if (v != null) v.Close();

    But I am getting error when I am trying to update the Binary file content with the updated text. Using below code:

     view = session.Database.OpenView("UPDATE `Binary` SET `Data` = ? WHERE `Name` = '{0}'", binaryKeyName);

      View view = null;
        Record rec = null;

         rec = new Record(1);
         rec.SetStream(1, stream);

    and getting error : function failed during execution. database table(s) update failed at view.Execute(rec) statement.

    Please help me in updating the Binary file using the Custom Action in WIX installation.



    • Moved by Barry Wang Thursday, July 24, 2014 6:25 AM
    Wednesday, July 23, 2014 1:44 PM


  • Hello Supriya,

    For WIX installer, please reopen a new case on the following forum:


    Your case is not supported on ClickOnce forum.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Thursday, July 24, 2014 6:08 PM
    • Marked as answer by Just Karl Saturday, August 2, 2014 1:11 PM
    Thursday, July 24, 2014 6:24 AM