user3281695
user3281695

Reputation: 55

Could not load file or assembly, or one of its dependencies

This is my first time using Visual Studio, or async in C#. I am using Visual Studio 2015 with this added reference (Any CPU): https://github.com/kade-robertson/AnimmexAPI/releases/tag/0.0.3 .

I am trying to test this API on a Windows Form App, but whenever I run it I get the following message:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Windows.Forms.dll

Additional information: Could not load file or assembly 'AnimmexAPI, Version=0.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Here is the code I am trying to run:

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());
        }
    }
}

Upvotes: 1

Views: 2441

Answers (1)

ViK
ViK

Reputation: 26

The solution: rename AnimmexAPI-AnyCPU.dll to AnimmexAPI.dll and include it again to your solution. The explanation is actually given in this answer: Loading renamed C# assembly throws FileNotFoundException

Upvotes: 1

Related Questions