I want to change the value of a ProductVersion tag in the below test.csproj file. I need to only change the value of the first occurrence of ProductVersion: 8A-0V-W3 to A0-B0-C0
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8A-0V-W3</ProductVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<ProductVersion>PK-0X-SD</ProductVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<ProductVersion>SD-AA-SW</ProductVersion>
</PropertyGroup>
I have come up with the below command, but it deletes all occurences of the tag. Is there a way only to delete the first occurence and then insert the updated tag into the same location
get-content ./test.csproj | select-string -pattern 'ProductVersion' -notmatch | Out-File ./test1.csproj