无法引用dll [英] Can't reference dll

查看:93
本文介绍了无法引用dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从Realia

COBOL程序(32位)添加对DLL程序的引用时出错。错误消息显示请确保

文件可访问,并且它是有效的程序集或COM组件。我可以使用C ++而不是C#来
访问此文件。我的COBOL DLL程序通过

引用传递数据。我的编码如下所示:


[DllImport(" progcmp1.dll",CharSet = CharSet.Auto,EntryPoint =" TRANPROG",

CallingConvention = CallingConvention.StdCall)]

public static extern void TRANPROG(string parms);


private void OnSubmit(object sender,EventArgs e)

{

StringBuilder parms = new StringBuilder(" 00000000",87);

TRANPROG(parms.ToString());

}

I get an error when trying to add a reference to a DLL program from a Realia
COBOL program that is 32 bit. The error message says "Please make sure the
file is accessible and that it is a valid assembly or COM component. I can
access this file using C++ but not C#. My COBOL DLL program passes data by
reference. My coding is shown below:

[DllImport("progcmp1.dll", CharSet=CharSet.Auto, EntryPoint="TRANPROG",
CallingConvention=CallingConvention.StdCall)]
public static extern void TRANPROG(string parms);

private void OnSubmit(object sender, EventArgs e)
{
StringBuilder parms = new StringBuilder("00000000", 87);
TRANPROG(parms.ToString());
}

推荐答案

只是一个想法:


你可能想尝试发送你的信息作为一个参考。


[DllImport(" progcmp1.dll",CharSet = CharSet.Auto,EntryPoint =" TRANPROG",

CallingConvention = CallingConvention。 StdCall)]

public static extern void TRANPROG(ref string parms);


private void OnSubmit(object sender,EventArgs e)

{

StringBuilder parms = new StringBuilder(" 00000000" ;,87);

string strParams = params.ToString();

TRANPROG(ref strParms);

}


" Parrot"写道:
Just a thought:

You might want to try sending your info as a reference also.

[DllImport("progcmp1.dll", CharSet=CharSet.Auto, EntryPoint="TRANPROG",
CallingConvention=CallingConvention.StdCall)]
public static extern void TRANPROG(ref string parms);

private void OnSubmit(object sender, EventArgs e)
{
StringBuilder parms = new StringBuilder("00000000", 87);
string strParams = params.ToString();
TRANPROG(ref strParms);
}

"Parrot" wrote:

我尝试从Realia

COBOL程序32位添加对DLL程序的引用时出错。错误消息显示请确保

文件可访问,并且它是有效的程序集或COM组件。我可以使用C ++而不是C#来
访问此文件。我的COBOL DLL程序通过

引用传递数据。我的编码如下所示:


[DllImport(" progcmp1.dll",CharSet = CharSet.Auto,EntryPoint =" TRANPROG",

CallingConvention = CallingConvention.StdCall)]

public static extern void TRANPROG(string parms);


private void OnSubmit(object sender,EventArgs e)

{

StringBuilder parms = new StringBuilder(" 00000000",87);

TRANPROG(parms.ToString());

}
I get an error when trying to add a reference to a DLL program from a Realia
COBOL program that is 32 bit. The error message says "Please make sure the
file is accessible and that it is a valid assembly or COM component. I can
access this file using C++ but not C#. My COBOL DLL program passes data by
reference. My coding is shown below:

[DllImport("progcmp1.dll", CharSet=CharSet.Auto, EntryPoint="TRANPROG",
CallingConvention=CallingConvention.StdCall)]
public static extern void TRANPROG(string parms);

private void OnSubmit(object sender, EventArgs e)
{
StringBuilder parms = new StringBuilder("00000000", 87);
TRANPROG(parms.ToString());
}


Parrot写道:
Parrot wrote:

我在尝试添加时遇到错误从Realia

COBOL程序引用一个32位的DLL程序。错误消息显示请确保

文件可访问,并且它是有效的程序集或COM组件。
I get an error when trying to add a reference to a DLL program from a Realia
COBOL program that is 32 bit. The error message says "Please make sure the
file is accessible and that it is a valid assembly or COM component.



你不能在你的项目中添加对DLL的引用,除非它是一个程序集

或一个COM库。如果你想访问一个既不是DLL,只需将它复制到一个可访问的地方(你的应用程序的\bin目录,

例子)。不要将其作为参考添加。


-

J.

You can''t add a reference to a DLL to your project unless it''s an assembly
or a COM library. If you want to access a DLL that''s neither, simply copy it
to an accessible place (the \bin directory of your application, for
example). Do not add it as a reference.

--
J.


先生。 Mostert:


我很好奇:如果你没有为你的项目添加一个DLL并将其包含在

\ bin文件夹中......你怎么称呼它?


我没有这方面的经验,但最近有人在工作,问我

如何做一些非常相似的事情。


" Jeroen Mostert"写道:
Mr. Mostert:

I''m curious: If you don''t add a DLL to your project and include it in the
\bin folder instead... how do you call it?

I have no experience in this, but someone at work recently came asking me
how to do something very similar.

"Jeroen Mostert" wrote:

你不能将DLL的引用添加到你的项目,除非它是一个程序集

或COM图书馆。如果你想访问一个既不是DLL,只需将它复制到一个可访问的地方(你的应用程序的\bin目录,

例子)。不要将其作为参考添加。

-

J.
You can''t add a reference to a DLL to your project unless it''s an assembly
or a COM library. If you want to access a DLL that''s neither, simply copy it
to an accessible place (the \bin directory of your application, for
example). Do not add it as a reference.
--
J.


这篇关于无法引用dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆