My powershell code actually reads data from an XML and stores the specific data to a csv file. The XML file somewhat looks like below:
<?xml version="1.0" encoding="utf-8"?>
<Report Version="10.0">
<Targets>
<Target Name="\\bin\testBusiness.dll">
<Modules>
<Module Name="testing.dll" AssemblyVersion="1.0.1003.312" FileVersion="1.0.0.0">
<Metrics>
<Metric Name="Maintainability" Value="78" />
</Metrics>
</Module>
</Modules>
</Target>
</Targets>
</Report>
I need to extract only the "testing.dll" from the above XML code. The code I am using to do so is as below:
$testDLL = [regex]::matches($xmlfile[5], '<mod name=".*" ')[0].value -replace '<mod name="(.*)" ','$1'
#the above code line gets even the AssemblyVersion
$testAssembver = [regex]::matches($xmlfile[5], 'AssemblyVersion=".*" ')[0].value -replace 'AssemblyVersion=".*" ','$1'
I don't need AssemblyVersion to be concatenated to the "testing.dll (mod name in xml)" from the XML code.
Currently I get something like:
testing.dll" AssemblyVersion=1.0.1000.112"
I just need testing.dll, everything thereafter should be ommitted.
Please help.
Thanks, Ashish