I created a simple PowerShell script to fix RDLC report definition by reverting from 2016 to 2008 version based on knowledge I found somewhere around here. However, the XML namespace is point to http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition which I'm afraid that someday it won't be available for some reasons. Kindly suggest on how to make this script work without relying on external/3rd party assets. For example, which files that I need to host on my web server. Thank you.
PS. I followed the link, but it's not a JSON nor XML format. Just a web page, so I lost there.
param (
[Parameter(Mandatory=$true)][string]$rptName
)
$file = (Get-Content $rptName)
$rptNameTarget = "Fixed_" + $rptName
# Take out unwanted tags
$file = $file -replace '<ReportSections>',""
$file = $file -replace '<ReportSection>',""
$file = $file -replace '</ReportSection>',""
$file = $file -replace '</ReportSections>',""
# Parse the XML doc
$xml = [xml]$file;
# Set the XML namespace
$xml.Report.xmlns = "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition";
# Remove ReportParametersLayout node
if ($xml.Report.ReportParametersLayout -ne $null) {
Write-Host "Removing ReportParametersLayout tags.."
$xml.Report.RemoveChild($xml.Report.ReportParametersLayout);
}
# Save the file to new filename
$xml.save($rptNameTarget)