问题
I am currently trying to add an assembly into report builder 3.0 to execute a method and return the result:
But I always get "#Error" in the preview. Even whe the method is that simple:
public static string Test()
{
return "test";
}
Reference is set the following:
Expression is:
=TestNamespace.TestClass.Test()
The assembly is registered in GAC and it seems that the method is being checked for availableness. Elsewise I get a different error.
回答1:
I finally fixed it.
Important is to set the following into AssemblyInfo.cs file:
using System.Security;
[...]
// added to use in Reporting Services
[assembly: AllowPartiallyTrustedCallers()]
More info:
http://www.sqlservercentral.com/blogs/dknight/2012/01/26/ssrs-custom-code-with-external-assemblies/ rsErrorLoadingCodeModule: what are the steps to deploy an assembly for use with Report Builder 2.0?
It is also not required to put the Assembly file in GAC. I simply put it here to test it locally:
C:\Program Files (x86)\Microsoft SQL Server\Report Builder 3.0
来源:https://stackoverflow.com/questions/16943653/report-builder-custom-method-of-assembly-returns-error