It was one of those unexpected errors that can drive you crazy since they provide absolutely no details as to why they are happening. Yet, I was not doing anything extraordinary – I was merely trying to create an SSRS report for Dynamics 365(turned out that’s an extraordinary task.. sometimes), it was 11 PM on Friday night (yes, I know.. who does it at 11 PM on Friday night.. ), and I was constantly getting this error:
I was also getting it at 12 AM, and at 1 AM on Saturday, and, then, I called it a day and gave up (only to get back to it on Saturday – see below)
The error went like this:
Error Uploading Report
This report can’t upload. This issue can occur when the Report Definition Language (RDL) file is not valid. If you contact support, please provide the technical details.
Activity ID: 47ebe340-68ed-4a4c-95b0-b5e1061c2b57
And, of course, it had some details in the log file:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An error occurred while trying to add the report to Microsoft Dynamics 365. Try adding the report again. If this problem persists, contact your system administrator.Detail:
<OrganizationServiceFault xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.microsoft.com/xrm/2011/Contracts”>
<ErrorDetails xmlns:d2p1=”http://schemas.datacontract.org/2004/07/System.Collections.Generic” />
<Message>An error occurred while trying to add the report to Microsoft Dynamics 365. Try adding the report again. If this problem persists, contact your system administrator.</Message>
<ExceptionSource i:nil=”true” />
<InnerFault i:nil=”true” />
<OriginalException i:nil=”true” />
<TraceText i:nil=”true” />
Unfortunately, those details were not particularly useful.
Did I mention I never created reports for Dynamics 365 on this particular laptop? So, before I started on Friday night, I had installed the following components:
- Visual Studio 2015 and Data Tools
- Report Authoring Extensions for Dynamics 365
That is supposed to be a supported configuration, according to the download page:
And, yet, it was not working.
So, how do you troubleshoot an issue like this? You can keep poking around, but there is a simple test:
- I’ve created a new report using Dynamics report wizard
- And downloaded it
- And loaded it into the Visual Studio
- Did some minor changes
- And tried to upload it back into Dynamics
Guess what – I got exactly the same error! But that meant I was onto something, and the only possible explanation was that Visual Studio had updated the report in such a way that it became incompatible with Dynamics somehow.
What could be incompatible? It would likely be the format of that RDL file. The report was working fine in the Visual Studio, though, so I spend about an hour looking at the schema, trying to get some clue.
And then I thought: is there actually a way to target different versions of the SSRS server when building a report? That was actually the right question, and there was an answer:
Did you happen to think it was the end of it? Well, why would it be.. I am writing a detective story here:)
So, no, it was not the end. I made those changes, I configured the project to target 2008-2014 versions:
It was around 10 AM on Saturday, btw..
And I tried uploading the report to Dynamics. The same stubborn error showed up again!
I spent the following 30 minutes scratching my head – this was kind of beyond me. But you can’t keep scratching your head forever when you need the report to be up and running.. so, why is it not making any difference. Was it the wrong option? I was on the right track – that was my gut feeling at that time. What did I miss? After a bit more scratching, I figured why don’t I look at the rdl again – may be I’d be able to spot the version number there? Sure enough, it was right there, right at the top of the file, and for some strange reason it was still telling me the report was targeting 2016 version:
Now this was strange..
What do we do when there is a question? We ask google. Here is what google answered:
God bless you, Google! And Rami A, whoever you are, who provided the final clue:
This is by design.
Posted by Riccardo [MSFT] on 12/18/2015 at 5:07 PM
By design, TargetServerVersion affects build output files, not source files. You deploy the build output files (which you can grab from the \bin\Debug or \bin\Release folder within your project) rather than the source files.
So there we go! If you ever run into this problem, do this:
- Change the target server version of your report project (make it 2008, …, 2014)
- Build/Rebuild the project!!
- Do not upload the original rdl file to Dynamics – instead, use the one you’ll find in the “bin/debug” or “bin/release” folder
(and, probably, don’t do those things in the new environment on a Friday night when you are supposed to be getting ready for the weekend instead:) )