小编Jef*_*yXu的帖子

Powershell编辑Xml导致Visual Studio报告不一致的行结束

Powershell初学者在这里..

所以我用PowerShell脚本创建了一个Nuget包.powershell脚本在安装Visual Studio项目时会修改其中的xml架构.问题是....

如果在xml文件中有多行块注释,如

<!--<foo>
   <bar>
   </bar>
</foo>-->
Run Code Online (Sandbox Code Playgroud)

脚本运行后,Visual Studio弹出一条消息,说我的文件有"不一致的行结束......"

如果没有评论,或者如果有单行注释

<!--foo-->
Run Code Online (Sandbox Code Playgroud)

没有问题.以某种方式,以块注释结尾的行由powershell函数从CRLF更改为其他内容.

这是我的powershell脚本,用于加载和保存xml文件

 [xml]$xml = gc $xmlFileLocation -encoding utf8

 $xml.Save($xmlFileLocation)
Run Code Online (Sandbox Code Playgroud)

我也尝试过类似的东西

 set-content -encoding utf8 $xmlFileLocation $xml.outerXml
Run Code Online (Sandbox Code Playgroud)

但我继续得到这个消息......

任何sugguests /帮助将非常感激.

xml powershell visual-studio-2010 nuget

8
推荐指数
1
解决办法
767
查看次数

标签 统计

nuget ×1

powershell ×1

visual-studio-2010 ×1

xml ×1