In MSBuild, you can create a new GUID like this
<PropertyGroup>
<SomeGuid>$([System.Guid]::NewGuid())</SomeGuid>
</PropertyGroup>
And then you can use the XmlPoke task to make the replacement using your newly created property $(SomeGuid).
Excerpted from in the book MSBuild Trickery tricks #9 and #101