简体   繁体   English

无法在VS2010中添加dll

[英]Not able to add dll in VS2010

I am trying to add the following dll as reference in the VS2010. 我正在尝试在VS2010中添加以下dll作为参考。 but it keeps throwing the "Please make sure it is a valid assembly or com" error. 但它不断抛出“请确保它是有效的程序集或com”错误。 When I tried to register the dll using regsvr32, it says "Not able to find an entry point". 当我尝试使用regsvr32注册dll时,显示“无法找到入口点”。 Can you please let me know how to make it work? 你能让我知道如何使它工作吗?

The dll can be downloaded from Here dll可以从这里下载

The example C# code provided by the vendor is Here 供应商提供的示例C#代码在此处

EDIT: 编辑:

The example code does use DllImport property. 该示例代码确实使用了DllImport属性。 When I run it, it says not able to find the dll. 当我运行它时,它说无法找到该dll。 So I was trying to add it as a reference. 所以我试图添加它作为参考。 I am new to C# so not sure what the problem is. 我是C#的新手,所以不确定是什么问题。 It breaks in the following line : 它在以下行中中断:

ftStatus = GetDllVersion(byteDllVersion, MAX_NUM_DLL_VERSION_CHARS);

Line 747 in the example code. 示例代码中的第747行。

Thanks... 谢谢...

If the dll is not developed under .Net , then you con not add it as a reference to your project. 如果该dll不是在.Net下开发的,则不要将其添加为对项目的引用。 Paste your dll in the Application startup path(Bin\\Debug) and import the dll like 将您的dll粘贴到Application startup path(Bin\\Debug)然后像导入dll一样

 [DllImportAttribute(@".\FTCI2C64.dll", EntryPoint = "I2C_GetDllVersion", CallingConvention = CallingConvention.Cdecl)]
    static extern uint GetDllVersion(byte[] pDllVersion, uint buufferSize);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM