This project has moved. For the latest updates, please go here.

ERROR: Type 'ImageMagick.MagickImage' is not defined.

Apr 26, 2014 at 2:15 AM
Good morning, I installed ImageMagick.Net with NuGet (Install-Package Magick.NET-Q8-x86) and it works correctly locally. However, when I compile and upload the files to the server, it gives the following error:
Compiler Error Message: BC30002: Type 'ImageMagick.MagickImage' is not defined.

Source Error:

Line 19:                 End If
Line 20: 
Line 21:                 Dim picture As New ImageMagick.MagickImage(Server.MapPath("~/mycube/img/") + uri)
Line 22:                 'Dim picture As New ImageMagick.MagickImage("C:\AppServ\www\hossman\" + uri)
Line 23: 
My code:
Public Class mycube
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            If Not Page.IsPostBack Then
                Dim uri As String = ""

                    uri = Request.QueryString("uri")
                Catch ex As Exception
                    uri = ""
                End Try

                If uri Is Nothing Then
                End If

                Dim picture As New ImageMagick.MagickImage(Server.MapPath("~/mycube/img/") + uri)

                Dim ancho As Integer = picture.Width()
                Dim alto As Integer = picture.Height()

                picture.BackgroundColor = ImageMagick.MagickColor.Transparent
                picture.MatteColor = ImageMagick.MagickColor.Transparent
                picture.VirtualPixelMethod = ImageMagick.VirtualPixelMethod.Transparent

                picture.Distort(ImageMagick.DistortMethod.Perspective, New Double() {0, 0, 2, 2, ancho, 0, 192, 1, ancho, alto, 193, 242, 0, alto, 2, 230})

                Dim fondo As New ImageMagick.MagickImage(Server.MapPath("~/mycube/img/") + "3dcubof.png")

                fondo.Composite(picture, 20, 16, ImageMagick.CompositeOperator.Over)
                fondo.BackgroundColor = ImageMagick.MagickColor.Transparent

                Dim buffer As New System.IO.MemoryStream
                fondo.ToBitmap().Save(buffer, System.Drawing.Imaging.ImageFormat.Png)
                Dim output = buffer.GetBuffer()
                Response.ContentType = "image/png"
                System.IO.File.Delete(Server.MapPath("~/mycube/img/") + uri)
            End If
        Catch ex As Exception
        End Try
    End Sub

End Class
I do not know how to fix it ... I have checked that the dll is correctly generated in the bin folder, and as I said, on my local computer works correctly, only server failure (both locally and on the server I have. Net Framework 4.0).

Thank you very much for your help.
Apr 26, 2014 at 7:28 AM
That is a strange error message. maybe the dll cannot be loaded? Did you install Visual C++ Redistributable for Visual Studio 2012 ( on your server?
Apr 26, 2014 at 5:03 PM
Surely that is the problem ... in any case it is a server hosting and I have no way of checking if Visual C++ is installed or not, and I can't install it ... it's a shame.

Thanks for your reply.