开发者

Build of project with RDLC cannot find custom assembly

开发者 https://www.devze.com 2023-02-23 10:04 出处:网络
I\'ve been tearing my hair out for three days trying to get an RDLC report to build in VS2010.I want to access a custom assembly from another project in the same solution in an expression for a Text i

I've been tearing my hair out for three days trying to get an RDLC report to build in VS2010. I want to access a custom assembly from another project in the same solution in an expression for a Text item on a subreport. There is a reference to the assembly in the project containing the RDLC and I added a reference to the assembly DLL in the properties of the subreport, but when I build it I get an error telling me it cannot find the file:

Error while loading code module: ‘CCCArchive, Version=2.0.847.11068, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'CCCArchive, Version=2.0.847.11068, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

The RDLC file appears to have no path information for the assembly in开发者_如何学Python the XML and I have tried putting copies of the assembly in the bin\Debug folder under the project containing the RDLC and in the same folder as the RDLC without success.

Judging from what little I have been able to find about this, it appears I may have to register the assembly in the GAC to get the build to work, but I can't find any direct confirmation of that and putting it in the GAC just to get the build to run would be a major nuisance.

Am I missing something?

...Jim Hansen


One possible solution that worked for me is described in this post:

Reporting Services – Custom report error (Error while loading code module: MarketingPilot.Framework.dll)

I copied the assembly referenced in the error message to this folder:

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

Doing this I could debug the application without a problem. :)


The accepted answer worked well for me in Visual Studio 2012, but the same solution did not work in Visual Studio 2013. Instead, I followed the suggestion from this post and copied the dll here:

C:\Program Files (x86)\MSBuild\12.0\Bin


Following the @rockariotphobia answer, for visual studio 2015 use:

C:\Program Files (x86)\MSBuild\14.0\Bin


I have been trying to make this work for a couple of days, finally make it:

  1. first you have to strongly type your dll https://msdn.microsoft.com/en-us/library/xc31ft41(v=vs.110).aspx

  2. register it in the GAC using Gacutil.exe (you have to do this every time you update your dll).

Now it will work... probably, after doing this I was able to locate the assembly but I got security issues: "An error Occurred during local report processing." ... "Attempt by security transparent method... ".

I am using .NET 4.5, loading the report from a winform.

To solved this in the AssemblyInfo I had to add 2 attributes:

            [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]

            [assembly: System.Security.AllowPartiallyTrustedCallers]

then just save, and re-install the dll in the GAC.

I hope this info helps someone.

Regards,

Caridad

0

精彩评论

暂无评论...
验证码 换一张
取 消