Search code examples
winformsdllreport

Project won't build because it can't load an assembly


Reports error on loading dll

I'm using Visual Studio 2019 Enterprise version 16.2.0

I have a dll library called RDLFunctions.dll to use in another WinForms application. Both projects are in the same solution that has worked for many years until I upgraded to Visual Studio 2019 and I can't go back. The WinForm app has about 50 reports and references the dll, but on project build, the reports that reference the dll all have similar errors (depending on which property is calling the dll).

Most research says to put the dll into several different folders:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\SSRS
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\PrivateAssemblies
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\PublicAssemblies

As well as to change values in:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\SSRS\RSPreviewPolicy.config to PermissionSetName="FullTrust"

I've deleted the file from all locations including the debug\bin directory of the dll project and rebuilt the dll. It went into the PrivateAssemblies folder automatically and I put it in the other directories. I removed/re-referenced the dll in the WinForms app, restarted the computer, etc. Nothing has helped. Everything used to work in Visual Studio 2017. I've excluded all reports in the project so it would build successfully, and it did. But when I added back even 1 report, I still got the errors.

Please help!

Here's and example of one of the error messages I get on the report "ActivityLog.rdlc"

Severity Code Description Project File Line Suppression State Error Error while loading code module: ‘RDLFunctions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'RDLFunctions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. Reports C:\SourceCode\Atlas\Mwells-Development-branch\Reports\Claims\ActivityLog.rdlc


Solution

  • copy the dll file to folder: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin

    it's will work.

    i'm using Visual Studio Enterprise 2019, Version 16.5.0