Re: [WiX-users] trying to add XML element to a web.config file

2014-08-21 Thread Steve-Ogilvie
Got it working :) AND it is the last line in the parent element which is
perfect...

now to figure out how to remove it on uninstall, I guess it would be the
same as install but uninstall?

util:XmlConfig
  Id=XmlWebConfigAddCreate
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  Action=create
  Node=element
  ElementPath=//configuration/location/system.webServer/modules
  Name=add
  On=install
  Sequence=1/

util:XmlConfig
  Id=XmlWebConfigAddType
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  ElementId=XmlWebConfigAddCreate
  Name=type
  Value=Blah, blah.2.2013
  Sequence=2/

util:XmlConfig
  Id=XmlConfigAddName
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  ElementId=XmlWebConfigAddCreate
  Name=name
  Value=AppCacheModule
  Sequence=3/
  /Component



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447p7596452.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] trying to add XML element to a web.config file

2014-08-21 Thread Nicholas Pierce
Hi,

I think you'll want to add a VerifyPath attribute to the XmlConfig element
that creates the 'add' element so that it doesn't pick up the existing
element called 'add'.  It will need to be something like
//configuration/location/system.webServer/modules/add[[]@name='Blah,
Blah.2.2013'[]], which will look for an element called add with an
attribute called name with that value (don't forget this is a formatted
value, hence the escaping around the square brackets).

I think you'll then want to have the XmlConfig element that creates the
'name' attribute, to be a child of the XmlConfig element that creates the
'add' element, so that the 'name' attribute gets applied to the 'add'
element you just created.  I think you can then remove the ElementPath
attribute for the child XmlConfig element.

There are now two cases: either add name=Blah.. will already exist,
in which case it won't be created by your installer, or it will not exist
and it will be created by your installer.  If you only want the 'type'
attribute to be set when the element is actually created, then you'll need
to put the XmlConfig element that creates the 'type' attribute as a child
of the XmlConfig element that creates the 'add' element (like the XmlConfig
element that creates the 'name' attribute).

If you want the 'type' attribute to the set regardless of whether your
installer actually created the element, then you'll need to change the
ElementPath attribute to an XPath expression that only picks up the add
element you want to modify:
//configuration/location/system.webServer/modules/add[[]@name='Blah,
Blah.2.2013'[]].

I haven't actually tried this, YMMV with some of the parameter values, but
hopefully it gives you some idea of where to look next.

Nicholas


On 21 August 2014 00:34, Steve-Ogilvie steven.ogil...@titus.com wrote:

 Okay I have it working...

 the only problem is that it is replacing the first add element which I
 don't want, I want it to be a new lt;add element underneath the first...

 lt;util:XmlConfig
   Id=quot;XmlWebConfigAddCreatequot;
   File=quot;[DIRECTORY_PATH_CLIENT]Web.Configquot;
   Action=quot;createquot;
   Node=quot;elementquot;

 ElementPath=quot;//configuration/location/system.webServer/modulesquot;
   Name=quot;addquot;
   On=quot;installquot;
   Sequence=quot;1quot;/

 util:XmlConfig
   Id=XmlWebConfigAddType
   File=[DIRECTORY_PATH_CLIENT]Web.Config
   Action=create
   Node=value

 ElementPath=//configuration/location/system.webServer/modules/add
   Name=type
   Value=Blah, Blah.2.2013
   On=install
   Sequence=2/

 util:XmlConfig
   Id=XmlConfigAddName
   File=[DIRECTORY_PATH_CLIENT]Web.Config
   Action=create
   Node=value

 ElementPath=//configuration/location/system.webServer/modules/add
   Name=name
   Value=AppCacheModule
   On=install
   Sequence=3/



 --
 View this message in context:
 http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447p7596448.html
 Sent from the wix-users mailing list archive at Nabble.com.


 --
 Slashdot TV.
 Video for Nerds.  Stuff that matters.
 http://tv.slashdot.org/
 ___
 WiX-users mailing list
 WiX-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wix-users

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] trying to add XML element to a web.config file

2014-08-21 Thread Steve-Ogilvie
thanks James and Nicholas...
phew trial and error and Google for about a day and a half :)

steve



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447p7596456.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] trying to add XML element to a web.config file

2014-08-21 Thread Steve-Ogilvie
thanks Nicholas,

got it removed on uninstall :) 

util:XmlConfig
  Id=XmlWebConfigAddRemove
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  Action=delete
  Node=element
  ElementPath=//configuration/location/system.webServer/modules
 
VerifyPath=//configuration/location/system.webServer/modules/add[\[]@type='Blah,
blah.2.2013'[\]]
  On=uninstall
  Sequence=100/



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447p7596455.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] trying to add XML element to a web.config file

2014-08-21 Thread Wired
Well I didn't get to post the problem/fix before you did (I noticed you used
ElementPath instead of ElementId), but I can at least help you a tiny bit
with the uninstall...

Component Id=XXXUninstall Guid=myGUID 
  util:XmlConfig
Id=XXXUninstall
File=[DIRECTORY_PATH_CLIENT]web.config
Action=delete
Node=element
VerifyPath=add[\[]@name='AppCacheModule'[\]]
   
ElementPath=//configuration/location/system.webServer/modules
On=uninstall
Sequence=1 /
CreateFolder/
  /Component

If I've modified this correctly it should handle the uninstall for you.
I remember the first time i tested an uninstall where i had to edit a
web.config, got it wrong and removed half my web.config :)

James



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447p7596454.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


[WiX-users] trying to add XML element to a web.config file

2014-08-20 Thread Steve-Ogilvie
Hi folks,

I am trying to add a new element to a web.config file, new element would be
similar to:

add type=Blah, Blah.2.2013 name=AppCacheModule /

The web.config file looks like this (it has other add elements under the
modules element:

?xml version=1.0 encoding=UTF-8?
configuration
  location inheritInChildApplications=false
  ...
system.webServer 
  ...
  modules 
 add name=something  type=some type, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=3/
add name my element here/
...
  /modules
/system.webServer
  /location
/configuration

I need to add my element below the 1st add under modules, I have tried
various things and nothing works quite right :(

util:XmlConfig
  Id=XmlWebConfigAddCreate
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  PreserveModifiedDate=yes
  Action=create
  Node=element
  ElementPath=//configuration/location/system.webServer/modules
  Name=add
  Sequence=1/

util:XmlConfig
  Id=XmlWebConfigAddType
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  PreserveModifiedDate=yes
  ElementPath=XmlWebConfigAddCreate
  Name=type
  Value=Blah, Blah.2.2013
  Sequence=2/

util:XmlConfig
  Id=XmlConfigAddName
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  PreserveModifiedDate=yes
  ElementPath=XmlWebConfigAddType
  Name=name
  Value=AppCacheModule
  Sequence=3/

this doesn't work :(

any idea what I am doing wrong?

thanks,

Steve




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


Re: [WiX-users] trying to add XML element to a web.config file

2014-08-20 Thread Steve-Ogilvie
Okay I have it working...

the only problem is that it is replacing the first add element which I
don't want, I want it to be a new lt;add element underneath the first...

lt;util:XmlConfig
  Id=quot;XmlWebConfigAddCreatequot;
  File=quot;[DIRECTORY_PATH_CLIENT]Web.Configquot;
  Action=quot;createquot;
  Node=quot;elementquot;
 
ElementPath=quot;//configuration/location/system.webServer/modulesquot;
  Name=quot;addquot;
  On=quot;installquot;
  Sequence=quot;1quot;/

util:XmlConfig
  Id=XmlWebConfigAddType
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  Action=create
  Node=value
 
ElementPath=//configuration/location/system.webServer/modules/add
  Name=type
  Value=Blah, Blah.2.2013
  On=install
  Sequence=2/

util:XmlConfig
  Id=XmlConfigAddName
  File=[DIRECTORY_PATH_CLIENT]Web.Config
  Action=create
  Node=value
 
ElementPath=//configuration/location/system.webServer/modules/add
  Name=name
  Value=AppCacheModule
  On=install
  Sequence=3/



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/trying-to-add-XML-element-to-a-web-config-file-tp7596447p7596448.html
Sent from the wix-users mailing list archive at Nabble.com.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users