0
I joined a recent project that uses a Nearby printer to print tax coupons.
The last one who worked on the project used a DLL (if I’m not mistaken in C++) that managed the printer.
In the project, this DLL is imported via the following command:
[DllImport(@"C:\InfoSAT\ptptrpro.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern Int32 SetProtocol(Int32 protocol);
When trying to execute the imported method, I am thrown a System.DllNotFoundException
stating that the specified module could not be found.
I found curious this error because in the folder informed in Import has this DLL.
My guess is:
1- This project was done at the time using Visual C# 2010 Express, and I’m trying to open it in Visual Studio 2015, it may be happening some incompatibility;
2- This DLL may be corrupted (difficult but not impossible);
3 - Something else I couldn’t imagine.
Thank you to anyone who can help me.
See in the project if it is referenced, for that go to References in the VS project explorer... If she is not, add a reference to her... It will be even better than "importing at hand", because then Voce will have the methods via Intellisense. You also need to add the library via the 'using' command to access it.
– Andre.Santarosa
Thanks for the answer, I tried to do this, but when trying to add a dll, it displays: The referent to 'C: Infosat ptrpro.ddl' could not be Added. Please make sure that the files is accessible, and that it is a Valid Assembly or COM Component.
– Guilherme Golfetto
Have to check the compatibility of the platform, try to compile in visual studio for x86 or x64
– Marco Giovanni