An error occurred: Unable to locate the file or assembly 'Interop.iTunesLib, Version=1.13.0.0, Culture=neutral, PublicKeyToken=null'

I've been attempting to connect to iTunes using C# programming language. The process involves creating a dll in C# and running it with TypeScript through the Overwolf API.

Here's what I've done so far:

Generated a .dll file

I utilized the iTunesLib library based on this resource. Apologies for the Japanese article reference.

I set up a ClassLibrary project in Visual Studio and tested it within a Windows Forms application, which proved successful.

Next, I compiled the ClassLibrary and obtained a .dll file.

namespace MyNamespace{
  public class MyClass {
    public void myFunction() {
      iTunesLib.iTunesAppClass iTunesApp = new iTunesLib.iTunesAppClass();
      // do something with iTunesApp ....
    }
  }
}

Invoking C# function in Typescript

overwolf.extensions.current.getExtraObject("myNamespace", (result) => {
        
  if (result.success) {
    pluginInstance = result.object;
    pluginInstance.myFunction(); // Calling the C# function
  }
}

Error Analysis

ERROR: Error: Failed to execute PauseITunes on AudioController with 0 arguments. details:
System.Reflection.TargetInvocationException: target threw an exception ---> System.IO.FileNotFoundException: Could not load file or assembly 'Interop.iTunesLib, Version=1.13.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies upon deploying the application
Where MyNamespace.MyClass.myFunction()


Although it worked flawlessly in the Windows Form Application, why does it encounter issues when built into a dll? The problem seems to be related to the iTunesLib component.

Answer №1

Following guidance from Heinz Siahaan, I successfully resolved the issue by placing interop.iTunesLib.dll in the corresponding directory level.

I am grateful for the assistance.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to locate all strings that fall between two specified values?

I need a List<string> with all the strings enclosed in brackets [ ] from the given string: Input = "[first] - [second] > [third] + 5" So, I am looking for the strings first, second, and third. ...

Is Typescript capable of converting ES6 code to ES5 during transpilation?

Currently, I'm in the process of developing an application utilizing Angular 2 and TypeScript. My goal is to incorporate a JavaScript method, specifically 'filter' for arrays, that is compatible with IE 11+, Chrome 45+, and other similar bro ...

Handling alert, confirm, and popup events in C# using Selenium

Despite extensive research, I have yet to find a solution that addresses the specific issue at hand. Our team is utilizing Selenium with C#. The main problem we are facing is our inability to control alerts, which may be due to their quick disappearance: ...

Create a solution that is compatible with both web browsers and Node.js

I am developing a versatile library that can be utilized in both the browser and in node environment. The project involves three json config files, with the latter two extending the tsconfig.json. tsconfig.json (contains build files) tsconfig.browser.js ...

When attempting to utilize drag and drop functionality in HTML5, the error message "DndSimulator is not

Currently, I am using selenium webDriver in C# on a Windows platform to automate tests involving HTML5 drag and drop. In my approach, I rely on the dragTo method from Selenium for achieving this functionality successfully in one test. However, when I attem ...

Angular - A simple way to conceal a specific row in a mat-table using Angular

I am looking to dynamically hide or show a specific column in a table by clicking on a button. The goal is to hide or delete the weight column when the "hide weight" button is clicked, and then show the weight column when the "show weight" button is clicke ...

Displaying and hiding child elements in a WPF Stack Panel

In my user interface, I have a stackpanel that includes two radio buttons: Option A and Option B. Only one of these can be selected at a time. When I choose Option B, I would like to show a set of text boxes below the Option B radio button within the sam ...

Encountering an issue while trying to execute the command "ionic cordova build android --prod --release

Currently, I am facing an issue while trying to build my apk for deployment on the Play Store. The error message is causing a time constraint and I urgently need to resolve it. Any help or suggestions regarding this matter would be greatly appreciated. ...

Calling a C# Webmethod using jQuery AJAX is not working as expected

I'm currently facing an issue calling a web method that I created. The problem lies in the fact that the ajax call isn't reaching my web method, which is puzzling to me because I have another web method in the same file with the same return type ...

Is it possible to retrieve a static resource within server-side code in NextJs?

Exploring the static render feature of NextJS to generate a static version of my website has led me to ensure that all necessary data is provided for the initial page render. I have stored several blog posts as .md files in /static and aim to access them ...

Placing startup and startup.auth code in .net framework (excluding .net core): Tips on proper placement

Here is the code snippet I am working with: https://github.com/nbarbettini/SimpleTokenProvider/tree/master/test/SimpleTokenProvider.Test This code was developed using .NET Core for building a WEB API. Now, I need to create a similar WEB API with the sam ...

Tamir frequently encounters issues with SharpSSH when attempting to download a file that is typically downloaded successfully using Filezilla

While attempting to download files from a client's SFTP, I have encountered some issues. Whenever I use Filezilla to do the downloads, everything goes smoothly without any problems. However, when trying to download files using our application that u ...

Connecting the SelectedItem of a listbox in ngPrime to an Observable Collection in Angular2

I am facing an issue while trying to use the ngPrime listbox in Angular2. I have a scenario where I am fetching an array of objects from Firebase as an observable and attempting to display it correctly in the listbox. <div *ngIf="addContactDialogVisibl ...

TS2322 error: Attempting to assign type 'any' to type 'never' is invalid

Currently, I am utilizing "typescript"- "3.8.3", and "mongoose": "5.9.11". Previously, my code was functional with version "typescript": "3.4.x", and "mongoose": "4.x". Here is a snippet of my code: https://i.stack.imgur.com/j3Ko2.png The definition for ...

The connection remains open and in an error state as it was not closed properly

I have a grid-view that loops through every row, but I encountered the following error: The variable name '@UserId' has already been declared. Variable names must be unique within a query batch or stored procedure. Although I resolved the initi ...

How can I get the class name of the drop destination with react-dnd?

Imagine having this component that serves as a drop target module. import { useDrop } from 'react-dnd'; import './css/DraggableGameSlot.css'; type DraggableGameSlotProps = { className: string, text: string } function Draggable ...

Tips for making a property non-nullable in Typescript

The Node built-in IncomingMessage type from DefinitelyTyped's definition (used as req in the (req, res, next) arguments) has specified that url can be nullable. This excerpt shows part of the definition: // @types/node/index.d.ts declare module "http ...

Data has not been loaded into the Angular NGX Datatable

As a beginner in Angular, I am struggling to set data from the module. ngOnInit() { this.populate(); } public populate() { this.productService.getAllProduct('6f453f89-274d-4462-9e4b-c42ae60344e4').subscribe(prod => { this. ...

Tips for iterating through nested objects with a for loop

Struggling with validations in an Angular 5 application? If you have a form with name, email, gender, and address grouped under city, state, country using FormGroupname, you might find this code snippet helpful: export class RegistrationComponent implemen ...

Adjust the dimensions of the Rectangle to fit a new size

When working with Windows Forms, I am capturing a full-size screenshot of a specific window with predetermined dimensions. The captured image is saved into a Bitmap object and then I use a Rectangle structure to crop a specific region of the screenshot for ...