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

Should I use Object.assign or define class properties?

Currently in the process of developing an angular application that interacts with the twitch API. The API returns data in various formats, some of which I need to parse and save into specific classes. My main concern is understanding the potential drawbac ...

My HTML files are not recognizing the IONIC Property within their own objects

As I delve deeper into understanding Angular and Ionic, a peculiar issue has arisen for which I seek a solution. I have several export classes containing HTML forms. In each corresponding .ts file, I declare a variable and import the relevant model to bin ...

Dealing with Errors in Node.js Using Typescript and Express

As I embark on my journey with Node and Typescript, a question has cropped up in my mind. There are two key files in my project: server.ts import express = require('express'); import IConfiguration from "../config/config"; export default clas ...

Implementing pagination within an Angular 11 Mat-table with grouping feature

Encountering an interesting issue with MatTable pagination and grouping simultaneously. I have two components each with a Mat-table featuring Pagination+Grouping. ComponentOne functions smoothly without any issues. When choosing to display 5 elements pe ...

After calling sequelize.addModels, a Typescript simple application abruptly halts without providing any error messages

My experience with Typescript is relatively new, and I am completely unfamiliar with Sequelize. Currently, I have only made changes to the postgres config in the .config/config file to add the dev db configuration: export const config = { "dev" ...

Using a Page Object in Selenium C# to verify the existence of an IWebElement

Objective: Determine if an element/IWebElement is present on the current page using PageObjects. I am familiar with the method that involves setting up a WebDriverWait object and waiting for the element to exist based on its ID: IWait wait = new WebDrive ...

By constantly subscribing to a Behavior Subject, updating the data, and then resetting the value, an endless loop is created

We have implemented a wizard functionality with lazy loading, consisting of a parent component and multiple child components. const routes: Routes = [ { path : '', component : WizardHomeComponent, canActivate: [HomeGuard], chil ...

Error: OpenQA.Selenium.ElementNotVisibleException: 'Element cannot be found'

Having trouble with finding and clicking on an element using the page's xpath. Even after inspecting it in firebug, the path does not work. Firebug can identify both the relative path and absolute path, but still the element cannot be found? IWebDriv ...

The POST requests on Next JS Mock API endpoints include parameters passed in the req.body

I am currently running Next JS API tests using jest with a custom testClient. The code for the testClient is as follows: import { createServer } from 'http'; import type { NextApiHandler } from 'next'; import type { __ApiPreviewProps } ...

Conditional Return Types in a Typescript Function

There is a function that can return two different types, as shown below: function doSomething(obj: {a: string, b?: string}): string | number { if (obj.b) { return 'something' } return 1 } When the function is called with an object cont ...

Create and save data to a local file using Angular service

I am facing an issue with my Angular service: import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { person } from '../interfaces/iperson ...

Using renderProps in combination with TypeScript

I've encountered an issue while trying to convert my React project to TypeScript, specifically with the login component that uses react-google-login. The error I'm facing is related to renderProps: Overload 1 of 2, '(props: { component: El ...

Challenges with variable scopes and passing variables in Ionic 2 (Typescript)

In my Ionic 2 TypeScript file, I am facing an issue with setting the value of a variable from another method. When I close the modal, I get undefined as the value. I'm encountering difficulty in setting the value for coord. export class RegisterMapP ...

The issue of empty strings not converting to null when passing a JSON object to a controller

My observation in ASP.NET Core 2.1 is quite the opposite of a similar question raised about string.empty being converted to null when passing JSON object to MVC Controller. In my case, when a JSON object with properties containing empty strings is sent ba ...

Creating a new JavaScript object using a Constructor function in Typescript/Angular

Struggling with instantiating an object from an external javascript library in Angular/Typescript development. The constructor function in the javascript library is... var amf = { some declarations etc } amf.Client = function(destination, endpoint, time ...

The variable is accessed prior to being assigned with the use of the hasOwnProperty method

Continuing my journey from JavaScript to TypeScript, I find myself faced with a code that used to function perfectly but is now causing issues. Despite searching for alternative solutions or different approaches, I am unable to resolve the problem. Snippe ...

Using custom hooks in JSX triggers a TypeScript error when the returned component is accessed

i just created a custom hook // useDropdown.ts function useDropdown(defaultState: number, options: number[]) { const [state, setState] = useState(defaultState); function Dropdown({ name }: { name: string }) { return ( <> <sel ...

Having trouble with Angular routing when attempting to directly access a specific URL path?

Seeking help with my routing setup in Angular. Using v12 of Angular. Encountering a 404 Not Found error when trying to access the direct URL for "register" at somesite.com/register. Uncertain if this is a server or Angular issue. Here is my router module ...

Refine specific unions by considering past values that have been used

Here's the scenario at hand: type Option = 'x' | 'y' | 'z' | 'w' type Inquiry = { query: string; choices: Option[]; defaultChoice: Option // here's where it gets tricky } I am looking to set the def ...

Integrating objects into the <select> element through the combination of C#, JavaScript, and HTML connected to a SQL

Can someone assist me in resolving this issue? I am trying to populate an HTML element with database fields using C# and JavaScript, but so far my code is not producing any output. I have also attempted to include a button that calls the "loadGrp" function ...