Search code examples
c#sql-serverreporting-services.net-assembly

SSRS 2016 Custom Assembly Deployment Not Working


I have a very simple custom assembly written in C# using VS2017 that is being deployed to Microsoft SQL Server Reporting Services Version 13.0.4435.0 running with SQL Server 2016 (SP1-CU3) (KB4019916) on a Windows 10 box.

Below is the C# code for this "Hello World" custom assembly:

Namespace MyCustomAssembly
{
    public class HellowWorldClass
    {
        public static string HellowWorld()
        {
            return "Hello World!";
        }
    }
}

Microsoft describes a step-by-step process for deploying a Custom Assembly:

https://learn.microsoft.com/en-us/sql/reporting-services/custom-assemblies/deploying-a-custom-assembly

Following the steps in the process, the first thing that I discovered is that the Report Designer default directory was different. After trying various folders, the destination that worked was the following:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\SSRS

After depositing the custom assembly DLL in this directory, the report preview worked as expected. This provided verification that the expression in the report textbox was defined correctly.

In accordance with the process, to deploy the custom assembly on the server the DLL should be placed in the following destination, adjusted for the specific SSRS version:

C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportServer\bin

The process then describes steps that extend the permissions of the custom assembly but this simple example should not require that. Execution permission should be sufficient. Therefore modification of rssrvpolicy.config should be unnecessary.

When I attempt to deploy the report to the serer by right clicking on the report in the Solution Explorer of VS2017 and selecting "Deploy", I get the following message (and only this text):

The definition of the report '/HelloWorldReport' is invalid.

If I remove the textbox containing the reference to the HelloWorld function in the custom assembly, the report deploys successfully to the server. So while there is no further information available in the message about why the report is invalid, it appears to be associated with the custom assembly on the server.

Here is what I have tried:

  • In spite of it not being required according to the process, I went ahead and edited rssrvpolicy.config to grant "FullTrust" to the assembly. Restarted the server.
  • I read that SSRS is based on .NET 3.5 (I built the assembly with 4.5.1) and that libraries needed to be built on .NET 3.5 to work. The custom assembly build was changed to use .NET 3.5.
  • Ensured that .NET 3.5 (and dependencies .NET 3.0 and 2.0) were installed on the server box. This was a long shot.
  • Reviewed various other tutorials and videos about the creation and deployment of custom assemblies. All seem to indicate that all that is necessary in this case is the placement of the DLL in the proper directory on the server.
  • Copied the custom assembly DLL in various other directories on the server. The thought was that if the VS2017 was in error maybe the server directory was also in error.
  • I looked into assembly security. Went through the signing process for the DLL. Used gacutil to install the custom assembly into the GAC.
  • In another desperate effort, I installed VS2017 community on the server and created a simple report and custom assembly on the server. Just as before, the VS2017 report preview presented itself correctly and the server deployment failed.

None of the above efforts worked.

I can share the RDL file or other material that might help identify the problem but I don't believe that the issue is with the report definition because the report will deploy if the references to the functions within the custom assembly are removed. And I don't believe that the issue is with the custom assembly because the preview works within the VS2017 environment. Is has to be something with the server but the error message is very opaque.

This is the first time that I have reached out to the SO community. I'm generally reserved and somewhat hesitant. Yet the experience of others has proven valuable to get by past development challenges and I am grateful. But I am really stumped this time. No one seems to have had this exact experience that I can find and I have searched exhaustively. I have little concern if the solution turns out to be a simple oversight or some basic ignorance that is worthy of ridicule. I just need a solution with what seems to be a non-problem for others.


Solution

  • One solution that worked is to use Report Manager to add the report rather than deploy from Visual Studio.