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 8514063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:45:30+00:00 2026-06-11T04:45:30+00:00

I got the following test code: <Target Name=TestTarget> <MSBuild.ExtensionPack.Xml.XmlFile TaskAction=UpdateElement File=@(ConfigurationFile) XPath=/MyConfiguration/Settings/RetentionTime InnerText=$(RetentionTime)/> </Target>

  • 0

I got the following test code:

<Target Name="TestTarget">
    <MSBuild.ExtensionPack.Xml.XmlFile
        TaskAction="UpdateElement"
    File="@(ConfigurationFile)"
    XPath="/MyConfiguration/Settings/RetentionTime"
        InnerText="$(RetentionTime)"/>
</Target>

(ConfigurationFile is within an ItemGroup, somewhere else I need the FullName, and so it comes in handy)

The output is:
XmlFile: C:\Development\Test\build\Test.xml
Update Element: /MyConfiguration/Settings/RetentionTime. InnerText: 30

No errors, build succeeded. However, when I open the XML file afterwards the RetentionTime element is still empty.

If I change the XPath to a non-existing element there is an error, so this should be right. Do you know if I’m missing something? I don’t get it…

  • 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-11T04:45:31+00:00Added an answer on June 11, 2026 at 4:45 am

    One pitfall is when the target-file declares a default namespace. This namespace must be provides in the xpath:

    <Target Name="TestTarget">
        <ItemGroup
          <_namespaces Include="MyNamespace">
            <Prefix>mns</Prefix>
            <Uri>http://myNamespace</Uri>
          </_namespaces>
        </ItemGroup>
    
        <MSBuild.ExtensionPack.Xml.XmlFile
            TaskAction="UpdateElement"
        File="@(ConfigurationFile)"
        XPath="/mns:MyConfiguration/mns:Settings/mns:RetentionTime"
            InnerText="$(RetentionTime)"
            Namespaces="@(_namespaces)"/>
    </Target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if i use the following code i got data in text file {title:sankas,description:sakars,code:sanrs} {title:test,description:test,code:test}
Use 'ant clean test' with the newest android sdk got error: build.xml:622: The following
I've got following code: File: Foo.h class Foo { friend void Bar(); }; File:
I got a problem with the following c# (test-)code: public static void TestBitmap2ByteArray(BitmapImage bitmap)
I got following code: function test () { this.testFunction = function () { //code
I got the following error when running the test code. How to workaround the
I've got the following code for a file upload with Apache's HTTP-Client (org.apache.http.client): public
Hello Everybody! I got the following error, while trying to test a code for
I've got following php code: $match = array(); if (preg_match(%^(/\d+)(/test)(/\w+)*$%, /25/test/t1/t2/t3/t4, $match)) print_r($match); I'm
I got the following entry in my database: images/test.jpg I want to trim the

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.