cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vikasvashishth
Level 3

How to delete/remove a tag from web.config

I'm using Installshield 2010, I want to delete/remove full tag from my web.config. How do i go ahead.... in XML file Changes

More clarification...

I have following tag in my Web.Config






Now i want to remove line or full tag completely...
Labels (1)
0 Kudos
(9) Replies
DebbieL
Level 17

I'm not sure how you would use the XML File Changes view to do this. Maybe you could try the Text File Changes view, which lets you configure changes for any text files (including XML files). In this view, you would create a replacement set node. Under that, you would create a replacement node. The replacement node contains settings such as Find What (where you would enter the line that you want to delete) and Replace With (where you would enter nothing).

I hope that helps.
0 Kudos
vikasvashishth
Level 3

Thanks DebbieL, This works.....
0 Kudos
PilotBob
Level 5

So is there no way to remove an element from an XML file in the XML section? I see that you can remove an attribute but not an element.

I see that possible I could set the elements content to ""... but how would I replace it on uninstall?

BOb
0 Kudos
DebbieL
Level 17

The XML File Changes view does not have support for deleting an element during an installation. However, the Text File Changes view, which was added in InstallShield 2010, is able to do this.

The ability to delete an XML element through the XML File Changes view is logged as feature request IOC-000066603.

If you are using an older version of InstallShield and you would like to delete an XML element during a Basic MSI installation, you would probably need to write custom actions, and perhaps leverage MSXML or other XML libraries directly in the custom actions. Maybe you can set the element content to "", as you mentioned, and then call one or more InstallScript functions such as StrReplace to search the XML file for the element line and replace it as needed, or comment it out (or remove the comment coding), depending on what you are trying to do.
0 Kudos
PilotBob
Level 5

OK, I'll give that a shot. Basically, I have to remove an element and add our own element. (I am currently using vb script, but it is a bit awkward to maintain).

So, can I remove the default element with the Text Change view then use the XML view to add the element I want? Or do I have to use one or the other? Are textfile changes sequenced prior to XML file changes?

So, I have to create another textfile change to run at uninstall to remove elements that are added to... or will the XML file change remove elements that were created on install during uninstall?

BOb
0 Kudos
DebbieL
Level 17

About this:
So, can I remove the default element with the Text Change view then use the XML view to add the element I want? Or do I have to use one or the other? Are textfile changes sequenced prior to XML file changes?

You can use both of those views to modify an .xml file on the target system. You can use the Custom Actions and Sequences view to see the scheduling for the built-in InstallShield actions that make the XML and text file changes. If you need to, you could probably change the order by moving the actions as needed. For example, the ISXmlInstall action makes the XML file changes that are configured in the XML File Changes view. That action occurs by default before the ISSearchReplaceInstall action, which makes the text file changes that are configured in the Text File Changes view.

About this:
So, I have to create another textfile change to run at uninstall to remove elements that are added to... or will the XML file change remove elements that were created on install during uninstall?

If you are using the XML File Changes view to configure elements that you want to be added during an installation, you can configure your project to remove that element during uninstallation automatically: Just make sure that the Remove element on uninstall check box on the Advanced tab for your XML element is selected.
0 Kudos
PilotBob
Level 5

DebbieL wrote:

If you are using the XML File Changes view to configure elements that you want to be added during an installation, you can configure your project to remove that element during uninstallation automatically: Just make sure that the Remove element on uninstall check box on the Advanced tab for your XML element is selected.


If I check that box to remove element on uninstall... is it only removed if it was created by the install? Or, is it removed in either case?

BOb
0 Kudos
DebbieL
Level 17

If the element is marked for removal at uninstallation, and the associated component was installed, uninstallation will unconditionally remove the element.
0 Kudos
jmresjm
Level 2

Even i need to remove the element along with attributes using installscript(not by using xml configuration),Can any one who can help......??
0 Kudos