[RhinoCommon] Having problems creating meshes

Hi, I am new to Rhino SDK.

I am trying to create a mesh through the example code from the SDK document, but I got some issues at the very beginning.
below is my code:

        Mesh mesh = new Mesh();                 //<- I got an error from here!
        mesh.Vertices.Add(0.0, 0.0, 1.0); //0
        mesh.Vertices.Add(1.0, 0.0, 1.0); //1
        mesh.Vertices.Add(2.0, 0.0, 1.0); //2
        mesh.Vertices.Add(3.0, 0.0, 0.0); //3
        mesh.Vertices.Add(0.0, 1.0, 1.0); //4
        mesh.Vertices.Add(1.0, 1.0, 2.0); //5
        mesh.Vertices.Add(2.0, 1.0, 1.0); //6
        mesh.Vertices.Add(3.0, 1.0, 0.0); //7
        mesh.Vertices.Add(0.0, 2.0, 1.0); //8
        mesh.Vertices.Add(1.0, 2.0, 1.0); //9
        mesh.Vertices.Add(2.0, 2.0, 1.0); //10
        mesh.Vertices.Add(3.0, 2.0, 1.0); //11

        mesh.Faces.AddFace(0, 1, 5, 4);
        mesh.Faces.AddFace(1, 2, 6, 5);
        mesh.Faces.AddFace(2, 3, 7, 6);
        mesh.Faces.AddFace(4, 5, 9, 8);
        mesh.Faces.AddFace(5, 6, 10, 9);
        mesh.Faces.AddFace(6, 7, 11, 10);
        mesh.Normals.ComputeNormals();
        mesh.Compact();

the error message is “An unhandled exception of type ‘System.DllNotFoundException’ occurred in RhinoCommon.dll.
Unable to load DLL ‘rhcommon_c’: The specified module could not be found. (Exception from HRESULT: 0x80070007E)”

How can I solve the issue?

Are you running an executable outside Rhino? If so, you must copy the rhinocommon_c.dll shared library to the folder where your executable is. RhinoCommon.dll is a wrapper around the c++ code.
Note that outside Rhino, you may run into problems when you try to use more advanced functionality, because that is only possible if you run you coffee as a plugin inside rhino.

thx menno,

I found the previous discussion Mysterious System.BadImageFormatException Error using MS test on VS Express 2013 when trying to create unit tests for a Grasshoppper plugin

Now my problems are solved.
thank you so much.