我有带有标签的 xml 文件,<File>
我需要从这些标签中删除一些变量及其值。version="$(Version_Infralution.Common.dll)">Infralution.Common.dll
以及所有变量版本及其值。我怎样才能在 C# 中做到这一点?
部分 XML 文件内容:
<File version="$(Version_Infralution.Common.dll)">Infralution.Common.dll</File>
<File version="$(Version_Infralution.Common.dll)">Infralution.Controls.dll</File>
<File version="$(Version_Infralution.Common.dll)">Infralution.Controls.VirtualTree.dll</File>
<File size="73728">Infralution.RichText.dll</File>
<File version="$(Version_Interop.DSOFile.dll)">Interop.DSOFile.dll</File>
<File version="$(Version_NLog.dll)">NLog.dll</File>
样本结果:
<File>Infralution.Common.dll</File>
<File>Infralution.Controls.dll</File>
<File>Infralution.Controls.VirtualTree.dll</File>
<File size="73728">Infralution.RichText.dll</File>
<File>Interop.DSOFile.dll</File>
<File>NLog.dll</File>
XML 文件结构在标签之前有很多子标签,例如:
<Products>
<Product name="Connectors">
<Registry>
<Reg key="HKEY_CURRENT_USER\Software\ScanJour\iBox\Install" value_name="SettingsEditorShortcuts" value="1" platform="x64" />
</Registry>
<SharedProductRef name="SharedProduct for: ModelBuilder Client, iBox Search, Connectors" />
<SharedProductRef name="SharedProduct for: ModelBuilder Client, iBox Server\iBox Utilities, iBox Server, iBox Server\ADODBC Manager, iBox Search, Connectors\Connector Manager, Connectors" />
<SharedProductRef name="SharedProduct for: SharePoint Server Add-on\Search Control Webpart, Connectors" />
</Product>
<Product name="Connectors\Connector Manager">
<FileSystem>
<Dir name="ProgramFilesX64" value="ScanJour\iBox\Common Components\ConnectorManager\">
<File version="$(Version_CSScriptLibrary.v2.0.dll)">CSScriptLibrary.v2.0.dll</File>
<File version="$(Version_Infralution.Common.dll)">Infralution.Common.dll</File>
<File version="$(Version_Infralution.Common.dll)">Infralution.Controls.dll</File>