VS2013 C # Cognex An error occurred while calling Quickbuild to do the program

Source: Internet
Author: User

An error occurs today when you use VS2013 C # to call Cognex's quickbuild to do the program, as follows

Mixed-mode assemblies are generated for the "v2.0.50727" version of the runtime and cannot be loaded in the 4.0 runtime without additional information being configured

Online Search Gets the solution:

Add a configuration section in App. Config: Startup

<startup uselegacyv2runtimeactivationpolicy= "true" >

<supportedruntime version= "v4.0"/>

</startup>

Here is an example,

private void Test ()
{
String FileName = @ "d:\vs2013\c# and quickbuild\testimg\2.bmp";
Bitmap Filebitmap = new Bitmap (FileName);

Cogimage8grey CogImg8 = new Cogimage8grey (FILEBITMAP);


Cogfindcircle findcircleparams = new Cogfindcircle ();
Findcircleparams.numcalipers = 50;
Findcircleparams.caliperprojectionlength = 5;
Findcircleparams.calipersearchdirection = Cogfindcirclesearchdirectionconstants.outward;
Findcircleparams.calipersearchlength = 30;

FindCircleParams.ExpectedCircularArc.AngleStart = 0;
FindCircleParams.ExpectedCircularArc.AngleSpan = 360;
FindCircleParams.ExpectedCircularArc.CenterX = 245;
FindCircleParams.ExpectedCircularArc.CenterY = 215;
FindCircleParams.ExpectedCircularArc.Radius = 80;

Cogfindcircletool Findcircletool = new Cogfindcircletool ();
Findcircletool.inputimage = CogImg8;
Findcircletool.runparams = Findcircleparams;
Findcircletool.run ();

Cogcircle thefindedcircle = FindCircleTool.Results.GetCircle ();
String Result = theFindedCircle.Radius.ToString ("0.000");
}

Each parameter can be set according to the Quickbuild tool.

Note that in order to refer to each namespace, the Findcircletool namespace is Cognex.visionPro.Caliper inside

VS2013 C # Cognex An error occurred while calling Quickbuild to do the program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.