Fix of issue 3678: problems in XDT causes the target file to be truncated.
Fix of issue 3678: problems in XDT causes the target file to be truncated.

The cause is that we use XmlTransformableDocument.Save(targetFile).
However, if an exception is thrown during save, the content of the targetFile can
get lost.

The fix is to save the xdt transform result into a memory stream first, then save
the memory stream into the target file. This way, if there's any problem with xdt,
the target file won't be touched.

OneGet/nuget,indsoft/NuGet2,jholovacs/NuGet,mrward/nuget,RichiCoder1/nuget-chocolatey,mrward/nuget,antiufo/NuGet2,oliver-feng/nuget,mrward/nuget,mono/nuget,xoofx/NuGet,jholovacs/NuGet,GearedToWar/NuGet2,mrward/NuGet.V2,jholovacs/NuGet,jmezach/NuGet2,chocolatey/nuget-chocolatey,oliver-feng/nuget,indsoft/NuGet2,oliver-feng/nuget,RichiCoder1/nuget-chocolatey,antiufo/NuGet2,OneGet/nuget,mrward/nuget,pratikkagda/nuget,chocolatey/nuget-chocolatey,antiufo/NuGet2,xoofx/NuGet,GearedToWar/NuGet2,jholovacs/NuGet,indsoft/NuGet2,rikoe/nuget,xoofx/NuGet,xoofx/NuGet,antiufo/NuGet2,jmezach/NuGet2,jholovacs/NuGet,RichiCoder1/nuget-chocolatey,jmezach/NuGet2,jholovacs/NuGet,GearedToWar/NuGet2,pratikkagda/nuget,xoofx/NuGet,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,jmezach/NuGet2,xoofx/NuGet,mrward/nuget,mrward/NuGet.V2,RichiCoder1/nuget-chocolatey,mono/nuget,oliver-feng/nuget,mrward/NuGet.V2,rikoe/nuget,jmezach/NuGet2,indsoft/NuGet2,oliver-feng/nuget,rikoe/nuget,jmezach/NuGet2,chocolatey/nuget-chocolatey,mrward/NuGet.V2,pratikkagda/nuget,oliver-feng/nuget,mrward/nuget,chocolatey/nuget-chocolatey,akrisiun/NuGet,akrisiun/NuGet,pratikkagda/nuget,GearedToWar/NuGet2,antiufo/NuGet2,mono/nuget,pratikkagda/nuget,rikoe/nuget,OneGet/nuget,OneGet/nuget,chocolatey/nuget-chocolatey,GearedToWar/NuGet2,chocolatey/nuget-chocolatey,indsoft/NuGet2,antiufo/NuGet2,mrward/NuGet.V2,mono/nuget,pratikkagda/nuget,indsoft/NuGet2,GearedToWar/NuGet2,RichiCoder1/nuget-chocolatey