Hello, >> A reference to "C:\myPATH\glpk_4_57.dll" could not be added. >> Please make sure that the file is accessible and that is a vaid assembly or >> COM component. glpk_4_57.dll is not an assembly but a native library. You have to ensure that it is in the library search path. see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx You could copy the dlls needed in the post build phase, see https://social.msdn.microsoft.com/Forums/en-US/1b1b316a-8648-4243-a651-84de51fd2508/reference-native-dll-from-managed-c-project?forum=vssmartdevicesvbcs http://stackoverflow.com/questions/1043913/copying-a-dlls-dependencies-in-visual-studio Best regards
Heinrich Schuchardt Gesendet: Donnerstag, 17. Dezember 2015 um 05:13 Uhr Von: "usa usa" An: "Heinrich Schuchardt" <[email protected]>, [email protected] Betreff: Fwd: [Help-glpk] build glpk.dll for C# so that I can call it from VS2013 on win7. Sorry, A typo in my last email. GLPK version is 4.57. ---------- Forwarded message ---------- From: usa usa <[email protected]> Date: Wed, Dec 16, 2015 at 11:08 PM Subject: Re: [Help-glpk] build glpk.dll for C# so that I can call it from VS2013 on win7. To: Heinrich Schuchardt <[email protected][[email protected]]> Cc: [email protected][[email protected]] Hi, I have downdloaded GPLK for C# from http://sourceforge.net/projects/glpk-cli/[http://sourceforge.net/projects/glpk-cli/]. I have installed it and passed all install test on win 7. GLPK version is 4.57 Now, I am trying to write a simple C# program from Visual Studio 2013 as follows: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using org.gnu.glpk; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("GLPK " + GLPK.glp_version()); // Got exception here } } } But, I got exception: An unhandled exception of type 'System.TypeInitializationException' occurred in ConsoleApplication1.exe Additional information: The type initializer for 'org.gnu.glpk.GLPK' threw an exception. From the README file of the package, I saw that "For building and running your own application you will need the following files from the w64 directory: * glpk\_?\_??.dll - the GLPK native library * libglpk\_cli\_native.dll - the GLPK for C#/CLI native library * libglpk\_cli.dll - the GLPK for C#/CLI assembly" When I was tryingto add them as reference to my C# prpject , I got: A reference to "C:\myPATH\glpk_4_57.dll" could not be added. Please make sure that the file is accessible and that is a vaid assembly or COM component. i got the same error for libglpk_cli_native.dll. Only libglpk_cli.dll can be added. Do I miss something here ? Why the installation test can be apssed (printed out GLPK version) but I cannot run the same program from Visual Studion 2013 ? Any help would be appreciated. Thanks _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
