Code Monkey home page Code Monkey logo

Comments (8)

chucklu avatar chucklu commented on May 27, 2024

when I remove the namespace from base.xml ,

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appSettings>
    <add key="test20180421" value="1" />
     <add key="test20180422" value="2" />
  </appSettings>
</configuration>

then the patch generated as following

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings>
    <add key="test20180423" value="3" xdt:Transform="InsertBefore(/configuration/appSettings/add[(@key='test20180422')])" />
  </appSettings>
</configuration>

and there is no problem to apply source.

I am not sure if this is a bug in this repository or just bug from Microsoft.Web.Xdt.
I have opened an issue here.

from fatantelope.

CameronWills avatar CameronWills commented on May 27, 2024

Hi @chucklu

Unfortunately, I wasn't able to reproduce the error you described. It could be related to the version of Microsoft.Web.Xdt being used.

I did however get a different error when I pasted your example into https://fatantelopetester.apphb.com to generate a patch. The error was related to the XML namespace on the node in base.xml: xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"

I removed the namespace and generated a patch, and then applied the patch using the FatAntelope.exe command line tool, and it correctly applied the patch.

So I suggest removing the XML namespace and trying again as it might be reason for the issue.

Cheers,
Cameron

from fatantelope.

chucklu avatar chucklu commented on May 27, 2024

Hi @CameronWills ,
The version of Microsoft.Web.Xdt I used is latest version 2.1.2. I also tried the version you used 2.1.1 .
Both of them have the same problem.

The workaround about remove the namespace I have found that, but that's weird.

What's the different error you got?

Actually I can encounter the same exception everytime.
When you try with the provide base.xml and target.xml, could you paste the patch.xml generated?

from fatantelope.

agility-matth avatar agility-matth commented on May 27, 2024

I know this is quite old. I've picked up this and I'm encountering the same problem. Though in my case it's
No element in the source document matches '/configuration/runtime/assemblyBinding/dependentAssembly[4]'

I'm not sure why it's occurring since XPath supports this syntax. Changing the index to a lower or higher number doesn't change the error. Updated the XDT nuget to 3.1.1 but no luck there either.

To get around this, instead of calling "InsertAfter(xyz)", I changed it to just "Insert". This solves my problem but means that I have to manually check my transformations to avoid this occurring during deployments.

from fatantelope.

chucklu avatar chucklu commented on May 27, 2024

@agility-matth Finally I give up to upgrade the config file through the library, because there are some custom setting in client's config file.
I just upgrade it by linq to xml, operate the xml node one by one programmatically.

from fatantelope.

agility-matth avatar agility-matth commented on May 27, 2024

from fatantelope.

CameronWills avatar CameronWills commented on May 27, 2024

@agility-matth are you able to provide the source & target files? Or at least just the /configuration/runtime/assemblyBinding sections of both files? Obviously remove anything sensitive from the files. Thanks

from fatantelope.

agility-matth avatar agility-matth commented on May 27, 2024

Sure thing @CameronWills , I'll see what I can do early next week and send it over.

from fatantelope.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.