SSRS report definition is newer than Server

后端 未结 8 1999
一个人的身影
一个人的身影 2020-11-27 04:29

I created some reports in Visual Studio 2015 with all the latest updates. However, when I try to deploy the reports I get this message:

The definition

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 04:43

    I have automated this task.

    create a form with a textbox named "TextBoxFile" and a button. In the code of the click button:

        Dim xmlDoc As New XmlDocument()
        xmlDoc.Load(TextBoxFile.Text)
        Dim root = xmlDoc.DocumentElement 
    
        For Each elel As XmlNode In root.ChildNodes
            Debug.WriteLine(elel.Name & " " & elel.NodeType)
        Next
    
        If root.Attributes()("xmlns").Value <> "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" Then
            root.Attributes()("xmlns").Value = "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
        End If
    
        Dim nsmgr = New XmlNamespaceManager(xmlDoc.NameTable)
        nsmgr.AddNamespace("bk", "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition")
    
        Dim autoRefreshElements = root.GetElementsByTagName("AutoRefresh")
        While autoRefreshElements.Count > 0
            root.RemoveChild(autoRefreshElements(0))
        End While
    
        Dim ReportParametersLayout = root.GetElementsByTagName("ReportParametersLayout")
        While ReportParametersLayout.Count > 0
            root.RemoveChild(ReportParametersLayout(0))
        End While
    
        Dim ReportSections = root.GetElementsByTagName("ReportSections")
    
        If ReportSections.Count > 0 Then
            ' Move content of ReportSections just below the block.
            Dim ReportSection = ReportSections(0).ChildNodes()
    
            ' First, copy the elements after
            Dim precedent = ReportSections(0)
            For Each child As XmlNode In ReportSection(0).ChildNodes
                Dim clone = child.Clone
                root.InsertAfter(clone, precedent)
                precedent = clone
            Next
    
            ' After deleting the existing block
            While ReportSections.Count > 0
                root.RemoveChild(ReportSections(0))
            End While
        End If
    
        xmlDoc.Save(TextBoxFile.Text) 
    
        MsgBox("Ok")
    

提交回复
热议问题