Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:25:58+00:00 2026-06-01T11:25:58+00:00

Give the following XML I’m trying to update the UpgradeImage and TargetImage SourceFile attributes

  • 0

Give the following XML I’m trying to update the UpgradeImage and TargetImage SourceFile attributes respectively using Linq to XML. Is there an issue with the way this XML is formed or am I just completely missing something?

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<PatchCreation
  Id="224C316C-5894-4771-BABF-21A3AC1F75FF"
  CleanWorkingFolder="yes"
  OutputPath="patch.pcp"
  WholeFilesOnly="yes">
<PatchInformation
    Description="Update Patch"
    Comments="Update Patch"
    ShortNames="no"
    Languages="1033"
    Compressed="yes"
    Manufacturer="me"/>

<PatchMetadata
    AllowRemoval="yes"
    Description="Update Patch"
    ManufacturerName="me"
    TargetProductName="Update"
    MoreInfoURL="http://andrewherrick.com/"
    Classification="Update"
    DisplayName="Update Patch"/>

<Family DiskId="5000"
    MediaSrcProp="Sample"
    Name="Update"
    SequenceStart="5000">
  <UpgradeImage SourceFile="c:\new.msi" Id="PatchUpgrade">
    <TargetImage SourceFile="c:\old.msi" Order="2" Id="PatchUpgrade" IgnoreMissingFiles="no" />
  </UpgradeImage>
</Family>

<PatchSequence PatchFamily="SamplePatchFamily"
    Sequence="1.0.0.0"
    Supersede="yes" />
</PatchCreation>
</Wix>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:25:59+00:00Added an answer on June 1, 2026 at 11:25 am

    I’m guessing you forgot to supply the namespace when querying

    XNamespace ns = "http://schemas.microsoft.com/wix/2006/wi";
    
    var doc = XDocument.Load(@"C:\test.xml");
    var ui = doc.Elements(ns + "Wix").Elements(ns + "PatchCreation").
                     Elements(ns + "Family").Elements(ns + "UpgradeImage").Single ();
    
    ui.Attribute("SourceFile" ).Value = "c:\newer.msi";
    
    doc.Save(@"C:\test2.xml");
    

    Edit

    An alternative is to use the XPathSelectElement extension method

    XmlNamespaceManager mgr = new XmlNamespaceManager(new NameTable()); 
    mgr.AddNamespace("ns", "http://schemas.microsoft.com/wix/2006/wi"); 
    var el = doc.Root.XPathSelectElement("//ns:Wix/ns:PatchCreation/ns:Family/ns:UpgradeImage", mgr);
    el.Attribute("SourceFile").Value = @"c:\evennewer.msi";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Give the following XML I am trying to split the contents of the extra
I have the following XML: <assessment> <section> <item> <attributes> <variables> <variable> <variable_name value=MORTIMER/> </variable>
I have the following XML. I'm trying to make a static button underneath my
For example,I want to generate the following xml file by using java with DOM
I am validaing a xml using following code snippet. SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); try
So I'm trying to do roughly the following: Take the following snippet of XML:
Can anyone give me an example of merging the following XML nodes with XSLT?
I'm trying to use an API with the following XML: <movies> <movie> <images> <image
I am wondering how to obtain the following from a query using xml on
I'm using the following function to put each facility node of my XML in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.