mmajcica / DeploySsrs

Build-Release task for VSTS/TFS that manages Microsoft's SQL Server Reporting Services
MIT License
21 stars 21 forks source link

Preserve carriage return and indenting in deployed rdl file #84

Open mayur-bhawar opened 1 year ago

mayur-bhawar commented 1 year ago

Rdl file is getting deployed without carriage return and indenting. New-SsrsReport() function in ssrs.pms1 file performs some manipulation on xmldocument object which ends up loosing formatting in xml file and prints entire xml content in single line in final rdl file.

Attached is the code fix to resolve this issue. Could you please review it and push the changes to git repo?

File - ssrs.psm1 Replace line no. 988 with following code.

` # To preserve carriage return and indenting in xml file use xml text writer

$rawDefinition = [System.Text.Encoding]::UTF8.GetBytes($Definition.OuterXml)

    $stringWriter = New-Object System.IO.StringWriter
    $xmlWriter = New-Object System.Xml.XmlTextWriter($stringWriter)
    $xmlWriter.Formatting = [System.Xml.Formatting]::Indented
    $Definition.WriteContentTo($xmlWriter)
    $rawDefinition = [System.Text.Encoding]::UTF8.GetBytes($stringWriter.ToString())

DeploySsrs.zip `

Updated source code is also attached as zip file.

mayur-bhawar commented 1 year ago

@mmajcica, I have created PR to fix xml formatting issue. Could you please review and approve PR https://github.com/mmajcica/DeploySsrs/pull/85 ?