We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error previewing/deploying SSRS report

Deploying/Previewing SSRS report. Aspose barcode in header and footer requires an image in SSRS. Fails with the following error …… Aspose version 19.1 updated to 19.8 same error…
Reports where I have the barcode in the body (not an image) preview/deploy ok.

[rsErrorLoadingCodeModule] Error while loading code module: ‘Aspose.BarCode.ReportingServices, Version=, Culture=neutral, PublicKeyToken=716fcc553a201e56’. Details: Could not load file or assembly ‘Aspose.BarCode.ReportingServices, Version=, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Do you use Visual Studio with SSRS or standalone SSRS service for Microsoft SQL Server? What version of VS or standalone SSRS do you use?

The problem looks strange because Version= it is too old version of Aspose.BarCode for ReportingServices. It looks like barcode dll wasn’t replaced.

If it is not difficult, could you manually watch dll in VS or SSRS folder and with right click on Aspose.BarCode.ReportingServices.dll file Properties->Details and write here version of the file.

Thanks for your response. I found the version of the aspose barcode in my SSRS Toolbox Report Items and the version in my Report Properties References Assemblies didn’t match. Regular barcodes work because there is no Report Properties Reference Assemblies needed. But for header/footer barcode images this is needed … resulting in the error because of the mismatch.

As I understood, you have used outdated barcodes version in SSRS and this caused the error. Not you are using new barcode version and problem is solved. Is this ok?

This issue was resolved but now I’m receiving an error related to the code: ‘SymbologyType’ is not a member of ‘Aspose.BarCode.ReportingServices.BarCodeBuilder’.
Using aspose version 19.1. Worked in previous version of aspose. Code from following article.

Visual Studio 2015

Ok, we need to review SSRS documentation because its state is obsolete at this time.

How it works. You have to

  1. manually create BarCodeBuilder object,
  2. setup data like symbology and codetext
  3. and extract image as byte stream.

In the 19.1 version(early but i don’t remember version number where it was changed) BarCodeBuilder interfaces were slightly changed and you have to use this construction:
objBarcode.EncodeType = EncodeTypes.Code39Standard;//SymbologyType is deprecated

In the 19.8 we removed BarCodeBuilder and added BarcodeGenerator. For the BarcodeGenerator you should use GetOnlyImageBarcode function, because BarcodeGenerator doesn’t have empty constructor (I think we will fix this).

Thank you for this question we will change the documentation to the current barcode library state.

Using 19.1 so I just updated the Report Properties Code… code I’m using is below. I’m now getting another error ‘EncodeType(s)’ is not a member of ReportingServices. Any ideas?

Tried with and without an ‘s’ on EncodeType same error…
– objBarcode.EncodeType = Aspose.Barcode.ReportingServices.EncodeTypes.Code39Standard
– objBarcode.EncodeType = Aspose.Barcode.ReportingServices.EncodeType.Code39Standard

Public Function GetBarCodeImage(ByVal codetext As String) as Byte()
objBarcode.CodeText = codetext
objBarcode.EncodeType = Aspose.Barcode.ReportingServices.EncodeTypes.Code39Standard
'Generate the barcode image
Dim ms As New System.IO.MemoryStream
Return ms.GetBuffer()
End Function

Also lots a reading yesterday so I think the change happened with or around version 17.10. There is some documentation indicating the need to update to EncodeType. I tried but no luck. This “report” was originally created with 7.8. Needed to copy it to another location and my laptop had been updated to 19.1 which seems to be the cause of this issue. Its working fine in the location I copied it from.

Correction originally created with aspose 6.7

EncodeTypes is a member of Aspose.BarCode.Generation. So you need to use
objBarcode.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Code39Standard.

It will be easier if you download original Aspose.Barcode, then create WinForms application and then create barcode image with BarCodeBuilder. Then you can just copy working code.

In Aspose.Barcode for .NET, BarCodeBuilder is in Aspose.BarCode namespace but in ReportingServices it is in Aspose.Barcode.ReportingServices namespace.
EncodeTypes is always in Aspose.BarCode.Generation namespace.

I will provide full working code some later.

Additionally, task was created to update ReportingServices documentation and it was assigned to the developer, who added changes to the generation API.

Is there a way to get aspose barcode images in Report Services? I need to be able to produce images because the barcodes are in the header and footer of the “report”. With version 19.1? 19.8?

Here is working code for 19.1 (code also can be provided for 19.8 if you want):

Public Function GetBarCodeImage(ByVal codetext As String) As Byte()
Dim objBarcode As New Aspose.BarCode.ReportingServices.BarCodeBuilder
objBarcode.CodeText = codetext
objBarcode.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Code39Standard
'Generate the barcode image
Dim ms As New System.IO.MemoryStream
Return ms.GetBuffer()
End Function

Working example you can download from the attachment.
Report Project1.zip (4.5 KB)

Also you have to:
In RSPreviewPolicy.config row

<CodeGroup class=“UnionCodeGroup” version=“1” PermissionSetName=“Execution” Name=“Report_Expressions_Default_Permissions” Description="This code group grants default permissions for code in report expressions and Code element. ">

Replace with row

<CodeGroup class=“UnionCodeGroup” version=“1” PermissionSetName=“FullTrust” Name=“Report_Expressions_Default_Permissions” Description="This code group grants default permissions for code in report expressions and Code element. ">

This allows signed libraries(strong named) as Aspose Barcode be called from unsigned code.

Here is example of manual trust setting for the code in VS and SSRS

Thank you. I’m going to make the changes now. Please include the changes needed for 19.8. Asked and we will most likely be going to 19.8 soon. Again THANKS!!!

The 19.1 changes work locally. I am able to preview my report and deploy it to the reporting server. However when I run the report on our reporting server I get the error below. Can you help with this?

Failed to load expression host assembly. Details: Attempt by security transparent method ‘ReportExprHostImpl+CustomCodeProxy…ctor(Microsoft.ReportingServices.RdlExpressions.ExpressionHostObjectModel.IReportObjectModelProxyForCustomCode)’ to access security critical method ‘Aspose.BarCode.ReportingServices.BarCodeBuilder…ctor()’ failed. Assembly ‘expression_host_7e2aabc883f748ec84e4859ca5aa957b, Version=12.3.5026.0, Culture=neutral, PublicKeyToken=null’ is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself. In order to access security critical code, this assembly must be fully trusted. (rsErrorLoadingExprHostAssembly)

C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportServer
Needed to change the rssrvpolicy.config
<CodeGroup class = “UnionCodeGroup” version=“1” PermissionSetName=“Execution” Name="Report_Expressions_Default_Permissions
From PermissionSetName = “Execution” to PermissionSetName=“FullTrust”

Good to know that your issue is sorted out. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thanks again. Still interested in changes needed for version 19.8 They tell me they plan to update soon.


Here is code that should work in 19.8:

Public Function GetBarCodeImage(ByVal codetext As String) As Byte()
Dim objBarcode As New Aspose.BarCode.Generation.BarcodeGenerator(Aspose.BarCode.Generation.EncodeTypes.Code39Standard)
objBarcode.CodeText = codetext
'Generate the barcode image
Dim ms As New System.IO.MemoryStream
Return ms.GetBuffer()
End Function

Please notice that BarcodeGenerator is located in Aspose.BarCode.Generation namespace. We will change namespace to Aspose.BarCode.ReportingServices in upcoming releases.

Thanks for all your help. Not sure when I will make these changes but expect soon. So again thanks!!