由于缺少权限,无法访问引用?

时间:2012-10-04 18:18:45

标签: c# .net winforms filenotfoundexception

我创建了一个应用程序表单,用于访问另一个程序中的标记。我使用 dll 来访问标签IOM.InTouchDataAccess。我运行程序,它一直工作,直到我写一个标签,然后按选择。错误:无法加载文件或程序集“IOM.InTouchDataAccess,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null”或其依赖项之一。系统找不到指定的文件。我还是新手程序员。 该程序在Program.cs中停止 Application.Run(new InTouchTagBrowser());

表单代码

public partial class InTouchTagBrowser : Form
    {
        public string tagName;

        public InTouchTagBrowser()
        {
            InitializeComponent();
        }

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

        private void SelectButton_Click(object sender, EventArgs e)
        {
            try
            {
                tagName = tagNameBox.Text;
                InTouchDdeWrapper inTouchWrapper = new InTouchDdeWrapper();
                string value = inTouchWrapper.Read(tagName);

                TagDotField tagDotField = new TagDotField(tagName);
                string description = inTouchWrapper.Read(tagDotField.Description);
                string engUnits = inTouchWrapper.Read(tagDotField.EngUnits);

                descriptionlbl.Text = description;
                englbl.Text = engUnits;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void WriteButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (tagName != "")
                {
                    MessageBox.Show("Please enter a tag!");
                }
                else
                {
                    string inputValue = ValueBox.Text;
                    InTouchDdeWrapper inTouchWrapperWriter = new InTouchDdeWrapper();

                    TagDotField tagWriter = new TagDotField(inputValue);
                    inTouchWrapperWriter.Write(tagName, inputValue);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                MessageBox.Show("Tag change successfull");
            }
        }

1 个答案:

答案 0 :(得分:1)

你没有提供太多信息。如果我是你,请列出我应该尝试的事项:

  1. 检查文件是否在硬盘中。 (检查\ debug文件夹)
  2. 如果文件存在,请仔细检查其版本是否为1.0.0.0
  3. 检查CopyLocal是否为真。
  4. 检查dll IOM.InTouchDataAccess 是否不需要其他dll。如果它是您安装的库的一部分,请确保所有dll都在那里。如果不确定,请使用.NET Reflector检查其依赖项。