Menu

Error adding snap7.dll as a reference in a C# Project

2015-03-03
2015-03-03
  • James Kelly

    James Kelly - 2015-03-03

    I recompiled the Snap 7 DLL's and authored a small test project using the code that was outlined in the Snap7 manual on page 85:

    Using Snap7;
    byte[] MyDB32 = new byte[256];
    static S7Client MyClient;
    static void SymplyGet()
    {
    MyClient = new S7Client();
    MyClient.ConnectTo(“192.168.10.100”,0,2);
    MyClient.DBRead(32, 0, 16, MyDB32);
    MyClient = null;
    }

    I added the snap7.net.cs file to my project. When I go to add the snap7.dll as a reference I keep getting the same error:

    A reference to "c:\users\jkelly\dev\snap7-full-1.30\snap7-full-1.3.0\build\bin\win64\snap7.dll" could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

    Has anyone had this problem? Up to now I have been working with Snap 7 in Linux but I need to write an app for Windows now using C#.

     
  • Davide Nardella

    Davide Nardella - 2015-03-03

    Hi James,
    you don't need (but moreover cannot) add a binary dll as a reference to a .net project.

    just copy snap7.dll (the correct one 32 or 64 bit) into the path of your executable.

    I added a new chapter into the manual (pag.262) and online about .net environment
    http://snap7.sourceforge.net/dotnet.html#key_concepts

    It will work as well as under linux ;)

    Let me know..

     

Log in to post a comment.

MongoDB Logo MongoDB