C# Custom Action, change some files during installation

8 messages Options
Embed this post
Permalink
Adrian Serafin

C# Custom Action, change some files during installation

Reply Threaded More More options
Print post
Permalink
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...
John Nannenga

Re: C# Custom Action, change some files during installation

Reply Threaded More More options
Print post
Permalink
You likely don't need your own CA for this, check out XmlConfig or XmlFile.

Your problem here is likely that you get a FileNotFoundException or something similar which is due to the fact you have your CA scheduled to execute in the "immediate" sequence and scheduled after "InstallFiles" which doesn't put any files onto the machine until the "deferred" sequence.



________________________________________
From: Adrian Serafin [[hidden email]]
Sent: Thursday, September 10, 2009 9:10 AM
To: [hidden email]
Subject: [WiX-users]  C# Custom Action, change some files during installation

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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Adrian Serafin

Re: C# Custom Action, change some files during installation

Reply Threaded More More options
Print post
Permalink
Hi!

Thank's for the response :) I need my own CA for some other things to ;)
Besides I found solution. If anyone needs it:

<Custom Action="EditConfig" After="InstallFinalize"
Overridable="no"></Custom>

where After="InstallFinalize" is the key ;)

Adrian

2009/9/11 John Nannenga <[hidden email]>

> You likely don't need your own CA for this, check out XmlConfig or XmlFile.
>
> Your problem here is likely that you get a FileNotFoundException or
> something similar which is due to the fact you have your CA scheduled to
> execute in the "immediate" sequence and scheduled after "InstallFiles" which
> doesn't put any files onto the machine until the "deferred" sequence.
>
>
>
> ________________________________________
> From: Adrian Serafin [[hidden email]]
> Sent: Thursday, September 10, 2009 9:10 AM
> To: [hidden email]
> Subject: [WiX-users]  C# Custom Action, change some files during
> installation
>
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Rob Mensching-6

Re: C# Custom Action, change some files during installation

Reply Threaded More More options
Print post
Permalink
That will only work if the target file is not in a per-machine directory
or you ran your entire MSI elevated (icky, icky, icky).

Adr!an Serafin wrote:

> Hi!
>
> Thank's for the response :) I need my own CA for some other things to ;)
> Besides I found solution. If anyone needs it:
>
> <Custom Action="EditConfig" After="InstallFinalize"
> Overridable="no"></Custom>
>
> where After="InstallFinalize" is the key ;)
>
> Adrian
>
> 2009/9/11 John Nannenga <[hidden email]>
>
>  
>> You likely don't need your own CA for this, check out XmlConfig or XmlFile.
>>
>> Your problem here is likely that you get a FileNotFoundException or
>> something similar which is due to the fact you have your CA scheduled to
>> execute in the "immediate" sequence and scheduled after "InstallFiles" which
>> doesn't put any files onto the machine until the "deferred" sequence.
>>
>>
>>
>> ________________________________________
>> From: Adrian Serafin [[hidden email]]
>> Sent: Thursday, September 10, 2009 9:10 AM
>> To: [hidden email]
>> Subject: [WiX-users]  C# Custom Action, change some files during
>> installation
>>
>> 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
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>> ------------------------------------------------------------------------------
>> 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
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>>    
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>  

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Roy Chastain

Please explain - "ran your entire MSI elevated"

Reply Threaded More More options
Print post
Permalink
Rob Mensching just made the reply below and I don't want to hi-jack that
conversation, but I would like an explanation of that that statement.
Do we have control over what part of the install is elevated and if so,
how?

----------------------------------------------------------------------
Roy Chastain




-----Original Message-----
From: Rob Mensching [mailto:[hidden email]]
Sent: Friday, September 11, 2009 06:40
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] C# Custom Action,change some files during
installation

That will only work if the target file is not in a per-machine directory
or you ran your entire MSI elevated (icky, icky, icky).

Adr!an Serafin wrote:

> Hi!
>
> Thank's for the response :) I need my own CA for some other things to
> ;) Besides I found solution. If anyone needs it:
>
> <Custom Action="EditConfig" After="InstallFinalize"
> Overridable="no"></Custom>
>
> where After="InstallFinalize" is the key ;)
>
> Adrian
>
> 2009/9/11 John Nannenga <[hidden email]>
>
>  
>> You likely don't need your own CA for this, check out XmlConfig or
XmlFile.
>>
>> Your problem here is likely that you get a FileNotFoundException or
>> something similar which is due to the fact you have your CA scheduled

>> to execute in the "immediate" sequence and scheduled after
>> "InstallFiles" which doesn't put any files onto the machine until the
"deferred" sequence.

>>
>>
>>
>> ________________________________________
>> From: Adrian Serafin [[hidden email]]
>> Sent: Thursday, September 10, 2009 9:10 AM
>> To: [hidden email]
>> Subject: [WiX-users]  C# Custom Action, change some files during
>> installation
>>
>> 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-install
>> ation-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
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>> ---------------------------------------------------------------------
>> --------- 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
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>>    
> ----------------------------------------------------------------------
> -------- 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>  

------------------------------------------------------------------------
------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Christopher Painter

Re: Please explain - "ran your entire MSI elevated"

Reply Threaded More More options
Print post
Permalink
In a "managed" or "elevated" install with a standard user,  the UI sequence runs with user privs.  But if you elevate the user process then the whole package runs elevated.

For example, you could have a setup.exe that is manifested to require elevation before invoking the MSI.  The user could then elevate or do an over the shoulder authentication to elevate.

This is not considered a best practice though.

Christopher Painter, Author of Deployment Engineering Blog
Have a hot tip, know a secret or read a really good thread that deserves attention? E-Mail Me


--- On Fri, 9/11/09, Roy Chastain <[hidden email]> wrote:

> From: Roy Chastain <[hidden email]>
> Subject: [WiX-users] Please explain - "ran your entire MSI elevated"
> To: "General discussion for Windows Installer XML toolset." <[hidden email]>
> Date: Friday, September 11, 2009, 5:56 AM
> Rob Mensching just made the reply
> below and I don't want to hi-jack that
> conversation, but I would like an explanation of that that
> statement.
> Do we have control over what part of the install is
> elevated and if so,
> how?
>
> ----------------------------------------------------------------------
> Roy Chastain
>
>
>
>
> -----Original Message-----
> From: Rob Mensching [mailto:[hidden email]]
>
> Sent: Friday, September 11, 2009 06:40
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] C# Custom Action,change some files
> during
> installation
>
> That will only work if the target file is not in a
> per-machine directory
> or you ran your entire MSI elevated (icky, icky, icky).
>
> Adr!an Serafin wrote:
> > Hi!
> >
> > Thank's for the response :) I need my own CA for some
> other things to
> > ;) Besides I found solution. If anyone needs it:
> >
> > <Custom Action="EditConfig"
> After="InstallFinalize"
> > Overridable="no"></Custom>
> >
> > where After="InstallFinalize" is the key ;)
> >
> > Adrian
> >
> > 2009/9/11 John Nannenga <[hidden email]>
> >
> >   
> >> You likely don't need your own CA for this, check
> out XmlConfig or
> XmlFile.
> >>
> >> Your problem here is likely that you get a
> FileNotFoundException or
> >> something similar which is due to the fact you
> have your CA scheduled
>
> >> to execute in the "immediate" sequence and
> scheduled after
> >> "InstallFiles" which doesn't put any files onto
> the machine until the
> "deferred" sequence.
> >>
> >>
> >>
> >> ________________________________________
> >> From: Adrian Serafin [[hidden email]]
> >> Sent: Thursday, September 10, 2009 9:10 AM
> >> To: [hidden email]
> >> Subject: [WiX-users]  C# Custom Action,
> change some files during
> >> installation
> >>
> >> 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-install
> >> ation-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
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/wix-users
> >>
> >>
> ---------------------------------------------------------------------
> >> --------- 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
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/wix-users
> >>
> >>     
> >
> ----------------------------------------------------------------------
> > -------- 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
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >   
>
> ------------------------------------------------------------------------
> ------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>


     

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Blair-2

Re: Please explain - "ran your entire MSI elevated"

Reply Threaded More More options
Print post
Permalink
In reply to this post by Roy Chastain
If you have a bootstrapper that is marked in Vista as "requiresElevation"
the entire MSI will be elevated since the MSI APIs will be called from that
elevated context. There are several negative issues that can result from
that (you may discover that the reason you need elevation causes repair or
even uninstallation failures).

The series of blogs with the table of contents on this post
(http://blogs.msdn.com/rflaming/archive/2006/10/01/uac-in-msi-notes-answers-
to-questions-in-comments-from-earlier-blog-posts.aspx) is an excellent guide
to understanding Rob's statement. I especially like this
(http://blogs.msdn.com/rflaming/archive/2006/09/21/765586.aspx) post in the
series to see what parts of the install run from the POV of the "installing
user" and from LocalSystem. Note that the "installing user" will either be
elevated or not depending on the context of whomever is calling the APIs.
Note also that msiexec.exe runs "asInvoker", so it won't elevate by itself.

This blog post
(http://blogs.msdn.com/astebner/archive/2006/12/13/some-useful-things-i-have
-learned-about-windows-installer-and-uac.aspx) is a good place to see how to
adjust WiX authoring to fix these issues.

-----Original Message-----
From: Roy Chastain [mailto:[hidden email]]
Sent: Friday, September 11, 2009 3:57 AM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Please explain - "ran your entire MSI elevated"

Rob Mensching just made the reply below and I don't want to hi-jack that
conversation, but I would like an explanation of that that statement.
Do we have control over what part of the install is elevated and if so,
how?

----------------------------------------------------------------------
Roy Chastain




-----Original Message-----
From: Rob Mensching [mailto:[hidden email]]
Sent: Friday, September 11, 2009 06:40
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] C# Custom Action,change some files during
installation

That will only work if the target file is not in a per-machine directory
or you ran your entire MSI elevated (icky, icky, icky).

Adr!an Serafin wrote:

> Hi!
>
> Thank's for the response :) I need my own CA for some other things to
> ;) Besides I found solution. If anyone needs it:
>
> <Custom Action="EditConfig" After="InstallFinalize"
> Overridable="no"></Custom>
>
> where After="InstallFinalize" is the key ;)
>
> Adrian
>
> 2009/9/11 John Nannenga <[hidden email]>
>
>  
>> You likely don't need your own CA for this, check out XmlConfig or
XmlFile.
>>
>> Your problem here is likely that you get a FileNotFoundException or
>> something similar which is due to the fact you have your CA scheduled

>> to execute in the "immediate" sequence and scheduled after
>> "InstallFiles" which doesn't put any files onto the machine until the
"deferred" sequence.

>>
>>
>>
>> ________________________________________
>> From: Adrian Serafin [[hidden email]]
>> Sent: Thursday, September 10, 2009 9:10 AM
>> To: [hidden email]
>> Subject: [WiX-users]  C# Custom Action, change some files during
>> installation
>>
>> 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-install
>> ation-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
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>> ---------------------------------------------------------------------
>> --------- 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
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
>>    
> ----------------------------------------------------------------------
> -------- 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>  

------------------------------------------------------------------------
------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users

----------------------------------------------------------------------------
--
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Ranjith Kumar S

Re: C# Custom Action, change some files during installation

Reply Threaded More More options
Print post
Permalink
In reply to this post by Adrian Serafin
 Please see if this can help  http://ranjithk.wordpress.com/2009/11/06/wix-update-application-configuration-files-during-installation/ 

Thanks,
Ranjith Kumar S.


-----Original Message-----
From: Adrian Serafin [mailto:[hidden email]]
Sent: 10 September 2009 19:40
To: [hidden email]
Subject: [WiX-users] C# Custom Action, change some files during installation


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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users