Tuesday, March 22, 2011

Invalid Target Namespace When Deploying a Report to SQLServer 2008

If you get an error like the following when deploying a report to SQLServer ReportingServices 2008, it is usually because the report was created in a design environment setup for SQL Server 2008 R2, but your server is SQL Server 2008 R1 (I know, that’s not what it’s called, but you know what I mean).

The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded. (rsInvalidReportDefinition)

To fix this error:

  • Edit the report RDL (Code View as it is called in BIDS).
  • Replace the Report header with the following:
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" 
    xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">


  • Remove the <ReportSections> and <ReportSection> tags from the report. Note, remove the tags only.  Leave all content inside the tag.  Don’t forget to remove the closing tags for each of these.
  • Save the report.  You should now be able to upload it.

29 comments:

  1. Great help it worked for me. Thanks a lot.

    ReplyDelete
  2. Gracias, gracias, gracias Totales!! viva internet y el conocimiento libre! después de mucho tiempo de intentarlo veo mis reportes!!! Thank's!! from Argentina

    ReplyDelete
  3. You Sir, are the MAN!
    You have no idea how long I was working on this.
    What an obsecure solutuion.
    Thank you!!!

    ReplyDelete
  4. Hello,

    Thanks for your help, it works fine in my developing side, but in the customer side, he got this error:

    "network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    "

    The connection string is correct in his side, because we have some parametres loaded correctly, do you think this error because of the change that I made in the file?

    Thanks,
    Manar

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Hi,

    I also used this solution an it was working, what to do in the case if we have ? We cannot just remove that, as we use it to get the data from datasource...

    Thank you!

    Aygun

    ReplyDelete
  8. Sorry, I don't understand why my comment is cropping. I wanted to write : "what to do in the case if we have Shared Datasets tag? "

    Best

    Aygun

    ReplyDelete
  9. Thanx dear,I faced the same Issue. now i've resolved it.

    ReplyDelete
  10. hmm...I attempt to upload a report...the Report header says 2008/01, BUT when I upload it (or attempt to), I get the same error over and over, 2010/01....

    Any other ideas?

    ReplyDelete
  11. Hi, I have VS2010, referencing Report libraries version 10 in web.config. Tried your tips but it didn't work. There is no "ReportSections" tags in my reports, and even if I put the 2008 schema, it won't work. Any ideas ?

    ReplyDelete
  12. Tried it with VS 2013, it gave me an error about the tags. Instead i recreated the report... and it worked.

    ReplyDelete
  13. Hello,

    I tried changing the header but it still gives me the same error. I have tried changing 2005 to 2008 and also 2010, but it gives same error everytime.. Any idea what it can be?

    Regards,
    Toral.

    ReplyDelete
  14. Sorry, it didn't work for me in Visual Studio 2012.

    I need to modify a report that has some pagebreaks. The pagebreaks are mainly put in for having an export as Excel workbook with multiple sheets. Each pagebreak forces the next section of the report being put on a new sheet. My customer now wants to have the sheets given specific names. For naming sheets there is a report property InitialPageName and elements can have a property PageName.

    The original rdlc file had the Report tag identical to the one you offer as a replacement. As soon as I set the InitialPageName or any PageName property, Visual Studio changes the XML by changing the Report tag, introducing the ReportSections and ReportSection tags and probably quite a few other things.

    When I modify the XML to restore the original Report tag and simply removing the ReportSections and ReportSection tags it will result in a deserialization error, because the child element 'InitialPageName' is not known in namespace 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'.

    Your solution masks the real cause of the problem and it wil work long as the report doesn't use any of the 2010 tags. Too bad for me, I need to use some, so I must look further to find and solve the real cause.

    ReplyDelete
  15. Hi there,

    My computer installed with VS2008r2 and the server installed with VS2008.

    I got the above title's error message when I deployed a report which carried the ResetPageNumber for Group setting. I understood once I change the setting for ResetPageNumber to True, the Code will change from 2008 to 2010, and not able to deploy to server.

    I modified as per suggested by the author, Rick, but not managed to deploy as the invalid namepsace error came out.

    Appreciate if you could provide any help and assistance.

    Thank you.

    ReplyDelete
  16. Worked for me, Thanks for the post.

    ReplyDelete
  17. Saved my life!! Thank you SO MUCH!!! Stupid PageName property in a 2008R2 project updated the namespace and err'd the report when we tried to deploy to a 2008R2 report server. This fix was just what we needed to clean it back up once we removed all the PageName values.

    ReplyDelete
  18. Thanks for the tip about the ReportSection tags.

    ReplyDelete
  19. Perhaps the ReportParametersLayout element needs to be removed too?

    ReplyDelete