SQLCLR Create Assembly Error

I am getting the following error when I attempt to create an assembly which uses Aspose.Pdf.


I am using version 17.4.0.

Msg 10301, Level 16, State 1, Line 1
Assembly ‘tgwcCommon’ references assembly ‘aspose.foundation, version=17.4.0.0, culture=neutral, publickeytoken=716fcc553a201e56.’, which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.


Hi Norm,


Thank you for contacting support. We are working over your query and will get back to you soon.

Hi Norm,


Thank you for being patient. We managed to replicate the said error in our working environment using Microsoft SQL Server 2016 (CLR 4.0). It has been logged under ticket ID PDFNET-42703 in our bug tracking system. We have also linked your post to this ticket and will let you know, once the significant progress has been made. We are sorry for the inconvenience caused.

Similar problem with Aspose.PDF 18.5 and Microsoft SQL Server 2017 14.0.2002.14 (X64)

CREATE ASSEMBLY [System.Drawing] FROM ‘C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Drawing.dll’
WITH PERMISSION_SET = UNSAFE
CREATE ASSEMBLY [Aspose.PDF] FROM ‘C:.…\Aspose.PDF.dll’ WITH PERMISSION_SET = UNSAFE

works fine and ends up with the following assemblies loaded:

  1. Aspose.PDF
  2. Microsoft.Build.Tasks.v4.0
  3. System.Runtime.Caching
  4. System.Xaml
  5. Microsoft.Build.Framework
  6. Microsoft.Build.Utilities.v4.0
  7. SMDiagnostics
  8. System.ServiceModel.Internals
  9. System.Runtime.Serialization
  10. System.Configuration.Install
  11. System.ServiceProcess
  12. System.DirectoryServices.Protocols
  13. System.ComponentModel.DataAnnotations
  14. System.Web.ApplicationServices
  15. System.Drawing.Design
  16. Accessibility
  17. System.Windows.Forms
  18. System.Design
  19. System.Web.RegularExpressions
  20. System.Runtime.Serialization.Formatters.Soap
  21. System.Runtime.Remoting
  22. System.EnterpriseServices
  23. System.DirectoryServices
  24. System.Web
  25. System.Drawing

Error is inside Aspose.PDF.Page.ConvertToPNGMemoryStream()

Stack trace:

at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at  ​..(String ) at  ​..() at  ​.(Object , ResolveEventArgs )
at System.AppDomain.OnResourceResolveEvent(RuntimeAssembly assembly, String resourceName)
at System.Reflection.RuntimeAssembly.GetResource(RuntimeAssembly assembly, String resourceName, UInt64& length, StackCrawlMarkHandle stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name)
at  ​ .(String , String , Assembly ) at  .(String ) at  .() at  .() at  .() at  .( & )
at Aspose.Pdf.Devices.ImageDevice.(Page )
at Aspose.Pdf.Devices.PngDevice.Process(Page page, Stream output)
at Aspose.Pdf.Facades.PdfConverter.(Page )
at Aspose.Pdf.Page.ConvertToPNGMemoryStream()
at UserDefinedFunctions.PDFToPNG(String pdfInfo, Byte[] document)

@syork.spitfiremanage

Thank you for contacting support.

Would you please upgrade to Aspose.PDF for .NET 19.1 and then share your kind feedback with us. In case the issue persists, please share narrowed down sample application and DLL file of your project while mentioning the steps to reproduce the issue.

Here is the stack from Aspose.PDF 19.1Aspose CLR.zip (373.7 KB)

The attached ZIP contains the VB2017 SQL SLR Project, deployment script and test script.
You will find references to a competitors PDF tool that WORKS PERFECTLY in the SQL CLR deployment.

test[1] - System.IO.FileNotFoundException: Could not load file or assembly ‘zx_bc86ffd0089c4489b2f8c9603ae5ebbd, PublicKeyToken=716fcc553a201e56’ or one of its dependencies.
The system cannot find the file specified. File name: ‘zx_bc86ffd0089c4489b2f8c9603ae5ebbd, PublicKeyToken=716fcc553a201e56’
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at #=qppcp$UOnRECkeWE3qESNUApMH7_fLrhs0XxzrvrVSxg=.#=zTT0v9ASec2gfj6tqBATHmqyAqlRw.#=z3orNgcmwViYu0Y6zVrYrQ208m1ib(String #=zqmN5Q6TjqGioSfeJ35om2zmCzDfQ)
at #=qppcp$UOnRECkeWE3qESNUApMH7_fLrhs0XxzrvrVSxg=.#=zTT0v9ASec2gfj6tqBATHmqyAqlRw.#=zRgacOPyKqL8ulFoYIHLAa8d4myva()
at #=qppcp$UOnRECkeWE3qESNUApMH7_fLrhs0XxzrvrVSxg=.#=zsrKmhxd501NvFsSVQvDzVMccI6B6(Object #=zylMvDJ0wtYYILKfGF5sng1cGkoby, ResolveEventArgs #=zWtO3_sdk3hGSWT7uRhIUAZI=)
at System.AppDomain.OnResourceResolveEvent(RuntimeAssembly assembly, String resourceName)
at System.Reflection.RuntimeAssembly.GetResource(RuntimeAssembly assembly, String resourceName, UInt64& length, StackCrawlMarkHandle stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name)
at #=ztypmhx77HtZ1LLS5vC1gIpf70I$v.#=zewJ8R15YnfLy(String #=zEE6qDds=, String #=zXUnKFmE=, Assembly #=z96erTAk=)
at #=z0dASLN7wQOsq_z9Dj5SsjND1ZtldTzxRQVTFvXU=.#=zeeFUA9B6xs9V(String #=zX4s$gLA=)
at #=z0dASLN7wQOsq_z9Dj5SsjND1ZtldTzxRQVTFvXU=.#=z4tg2u3rA6FJb()
at #=z0dASLN7wQOsq_z9Dj5SsjND1ZtldTzxRQVTFvXU=.#=zZl82nPT$vcKa()
at #=z0dASLN7wQOsq_z9Dj5SsjND1ZtldTzxRQVTFvXU=.#=zZd9S3Yw=()
at #=zPVWVjCyah_TMHUWViTXz62LTIxew.#=zhBRLJYE=(#=zK0Zae2nT9grrdestLRwNBCgRmpsSL8R2ORSIRuKbDFtA& #=zmrHx47E=)
at Aspose.Pdf.Devices.ImageDevice.#=zhBRLJYE=(Page #=zfvoEoF8=)
at Aspose.Pdf.Devices.PngDevice.Process(Page page, Stream output)
at Aspose.Pdf.Facades.PdfConverter.#=zchpYpsNHqlJd4fk2Nw==(Page #=zfvoEoF8=)
at Aspose.Pdf.Page.ConvertToPNGMemoryStream()
at UserDefinedFunctions.PDFToPNG(String pdfInfo, Byte[] document)

@syork.spitfiremanage

Thank you for sharing respective data.

We have recorded your concerns and have logged a ticket with ID PDFNET-45876 in our issue management system for further investigations and resolution. We will let you know as soon as some significant updates will be available in this regard.