Hi! 

I'm struggling with this for some time now... I'm trying to make my custom
action to modify applications config.exe file but no success. Maybe someone
can help??

<CustomAction 
                Id="EditConfig" 
                BinaryKey="EditConfigDLL" 
                DllEntry="EditCPConfig" 
                Execute="immediate"  
                Return="ignore" />
<Binary Id="EditConfigDLL" SourceFile="ConfigEditCA.CA.dll" />
<InstallExecuteSequence>
<Custom Action="EditConfig" After="InstallFiles" Overridable="no"></Custom>     
        
</InstallExecuteSequence>

And here is c# code:

public static ActionResult EditCPAConfig(Session session)
        {
            string db_user = session["DB_USER"];
            string db_password = session["DB_PASSWORD"];
            string u_profile = "localSU";

            string installdir = session["INSTALLDIR"];

            System.Xml.XmlDocument xml_doc = new System.Xml.XmlDocument();
            System.Diagnostics.Debugger.Launch();
            xml_doc.Load(installdir + "Cairo.Producer.Admin.exe.config");
            System.Diagnostics.Debugger.Launch();
            System.Xml.XmlElement conf_elem = xml_doc.DocumentElement;
            System.Xml.XmlElement conn_string =
(System.Xml.XmlElement)conf_elem.FirstChild;
            System.Xml.XmlElement add_conn = xml_doc.CreateElement("add");

            add_conn.SetAttribute("name", u_profile);
            add_conn.SetAttribute("connectionString", "something");
            add_conn.SetAttribute("providerName", "Npgsql");

            conn_string.AppendChild(add_conn);
            xml_doc.Save(installdir + "Cairo.Producer.exe.config");
            System.Diagnostics.Debugger.Launch();

            return ActionResult.Success;
        }

Code works when i put files in installfolder on my computer...
-- 
View this message in context: 
http://n2.nabble.com/C-Custom-Action-change-some-files-during-installation-tp3617476p3617476.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to