【问题标题】:Could not load file or assembly, or one of its dependencies无法加载文件或程序集,或其依赖项之一
【发布时间】:2016-08-21 05:11:50
【问题描述】:

这是我第一次使用 Visual Studio,或 C# 中的 async。我正在使用 Visual Studio 2015 和这个添加的参考(任何 CPU):https://github.com/kade-robertson/AnimmexAPI/releases/tag/0.0.3

我正在尝试在 Windows 窗体应用程序上测试此 API,但每当我运行它时,我都会收到以下消息:

System.Windows.Forms.dll 中出现“System.IO.FileNotFoundException”类型的未处理异常

附加信息:无法加载文件或程序集“AnimmexAPI,Version=0.0.3.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。系统找不到指定的文件。

这是我要运行的代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AnimmexAPI;

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

        private async void button1_Click(object sender, EventArgs e)
        {
            var api = new AnimmexClient();
            var fellowshipVid = await api.ImFeelingLucky("fellowship of the ring");
            MessageBox.Show(fellowshipVid.ToString());
        }
    }
}

【问题讨论】:

  • 你好! AnymexAPI 的创建者在这里 :) 我的建议是使用 NuGet 现在可用的包,它也会处理依赖关系!

标签: c# .net


【解决方案1】:

解决方案:将 AnimmexAPI-AnyCPU.dll 重命名为 AnimmexAPI.dll 并将其再次包含到您的解决方案中。 这个答案其实已经给出了解释:Loading renamed C# assembly throws FileNotFoundException

【讨论】:

    猜你喜欢
    • 2021-12-12
    • 2012-01-14
    • 1970-01-01
    相关资源
    最近更新 更多