Remove unwanted (empty) xmlns attribute added by appendChild

后端 未结 6 1630
失恋的感觉
失恋的感觉 2020-12-18 18:32

I have this code:

function setupProject($projectFile) {
  [xml]$root = Get-Content $projectFile;

  $project = $root.Project;

  $beforeBuild = $root.CreateE         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-18 18:51

    Check these for possible solutions:

    Powershell and csproj

    Xml namespace and C# csproj

    Here is a workaround from the second solution that worked for OP:

    $content = [xml] $content.OuterXml.Replace(" xmlns=`"`"", "")
    $content.Save($_.FullName);
    

提交回复
热议问题