【问题标题】:Dll does not seem to be read, why?dll好像没有被读取,为什么?
【发布时间】:2012-09-24 18:05:18
【问题描述】:

我正在创建一个应用程序表单来查看/更改来自名为 InTouch 的软件的标签。

我添加了 dll 作为参考,我想在 IOM.InTouchDataAccess 中使用 Read(string tagName) fct。当我写InTouchWrapper TagType = new read() 时,VS 看不到 fct Read。它只看到我在代码中写的 InTouchWrapper,这给了我错误IOM.InTouchDataAccess.InTouchWrapper' does not contain a constructor that takes 0 arguments

我不明白为什么会这样。我在编写代码时正在运行 InTouch 软件,可能与软件存在访问冲突。

我的代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IOM.InTouchDataAccess;

namespace TagBrowser
{
    public partial class TagBrowser : Form
    {
        public TagBrowser()
        {
            InitializeComponent();
        }

        private void TagBrowser_Load(object sender, EventArgs e)
        {
        }

        private void TagBox_TextChanged(object sender, EventArgs e)
        {
        }

        private void TypeBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            InTouchWrapper TagType = new InTouchWrapper();
        }

dll

using System;
using System.Collections.Generic;
using System.Text;
using NDde.Client;

namespace IOM.InTouchDataAccess
{
    public class InTouchDdeWrapper : IDisposable
    {
        private int DDE_TIMEOUT = 60000;

        private DdeClient _ddeClient;

        public InTouchDdeWrapper()
        {
            _ddeClient = new DdeClient("View", "Tagname");
        }

        ~InTouchDdeWrapper()
        {
            Dispose();
        }

        public void Initialize()
        {
            _ddeClient.Connect();
        }

        public string Read(string tagName)
        {
            return _ddeClient.Request(tagName, DDE_TIMEOUT).Replace("\0", "");
        }

【问题讨论】:

  • InTouchWrapper != InTouchDdeWrapper -- 请显示正确的代码。
  • 你在 ASPX 代码中添加了该 dll 的引用吗?
  • 我的 VS 中只有 IntouchWrapper 是可见的。 InTouchDdeWrapper 好像不存在
  • 右键标签浏览器->添加引用->添加dll
  • 您确定它是您引用的正确 dll 吗?尝试在反编译器(JustDecompile、Reflector 或 dotPeek)中打开准确引用的 dll,看看它是否是您期望的代码。

标签: c# .net object constructor instantiation


【解决方案1】:

我把这个放在这里以防其他人遇到同样的问题:

您确定它是您引用的正确 dll 吗?尝试打开 反编译器中精确引用的 dll (JustDecompile free, Reflector 或 dotPeek free) 看看是不是你的代码 期待。

【讨论】:

    猜你喜欢
    • 2023-02-13
    • 2013-03-13
    • 1970-01-01
    • 2014-12-18
    • 1970-01-01
    • 2015-08-08
    • 2013-10-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多