Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

XML node InsertAfter is not working properly

$
0
0

In VS *.csproj file, I have 3 Itemgroup tags, Inside in 2nd tag I have update one more tag like below 

       <Res Include = "3" >  
            <Culture>fr</Culture>  
        </Res>

Using insertbefore method I can update above tag at ======location 1 ======
using $root.insertafter($a, $root,itemgroup.item(1))

but I want to add the tag at ======location 2 ======and getting error 
for the same I am changing above code  as $root.insertafter($a, $root,itemgroup.item(1).name)

can not convert itemgroup type string to system.xml.xmlnode

{I just want to add node at location 2 instead of location 1 }

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
   1. <ItemGroup>  <X= "Strings.fr.resources" >  <Culture>fr</Culture>  </X>  <XX= "Dialogs.fr.resources" >  <Culture>fr</Culture>  </XX>  </ItemGroup> 
======location 1 don't want to add node here======
    2.<ItemGroup>  
======location 2 just want to add node here======<Res Include = "1" >  <Culture>fr</Culture>  </Res>  <Res Include = "2" >  <Culture>fr</Culture>  </Res>  </ItemGroup>

   3.<ItemGroup>  <Res YY= "Strings.fr.resources" >  <Culture>fr</Culture>  </YY>  <Res YY = "Dialogs.fr.resources" >  <Culture>fr</Culture>  </YY>  </ItemGroup><projectgroup><projectdetails = "Strings.fr.resources" >  <Culture>fr</Culture>  </projectdetails>  </projectgroup></Project>  






Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>