0

So I've been stuck on this error for a good week now, and it has been very frustrating

enter image description here

(Impossible to load the file or assembly 'Audio.Default.Switcher.Wrapper.dll' or one of its dependencies. The specified module wasn't found)

I'm working with Visual Studio 2017 and I've downloaded the SoundSwitch project, and everything is working perfectly fine. I'm able to run "SoundSwitch" without any errors.

The way the solution works (as I'm able to understand) is that the "SoundSwitch" C# project is the "master" and it has references to "Audio.Default.Switcher.Wrapper" as well as "SoundSwitch.UI.UserControls"

"Audio.Default.Switcher.Wrapper" as a reference to "AudioDefaultSwitcher"

  • Both "Audio.Default.Switcher.Wrapper" and "AudioDefaultSwitcher" seem to compile as .dll files
  • "SoundSwitch.UI.UserControls" cannot be started and is used for display stuff I guess
  • "SoundSwitch" is the only startable project (not counting mine of course)

enter image description here

The K005_test is MY project, I've added it and it has references (only) to "SoundSwitch" and I'm trying to use the functions from the SoundSwitch project inside K005_test. And so far my K005_test project consists only of

Program.cs (where I get the error by the way)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace K005_test
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1()); //Exception thrown here
        }
    }
}

Form1.cs (where I put my code for the test)

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;

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

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This is a test");
            var test = SoundSwitch.Model.AppModel.Instance.AvailablePlaybackDevices; //Error this line exists
        }
    }
}

And when I run my K005_test project, it compiles and runs just fine, except when I click the button Then I get the error I posted above. Also the message box doesn't open.

What I've tried so far :

  • Flipping everything to "x86" or "Win32", it seems that it might be related a problem with 64bit something
  • Using references to both "Audio.Default.Switcher.Wrapper.dll" and "SoundSwitch" in K005_test
  • copy "Audio.Default.Switcher.Wrapper.dll" pretty much everywhere and praying the gods
  • Trying to understand where it looks for "Audio.Default.Switcher.Wrapper.dll" but I wasn't able to find anything when looking in the exception details

Nothing has helped in any way.

For anybody wondering, I've uploaded my entire project folder here

https://drive.google.com/open?id=1OABjDiZyF0B-1-b15_9lzMrPZ4UpyKqU

Klue
  • 73
  • 9
  • 1
    Does the project use some native dependencies? – Vlad Feb 14 '19 at 17:56
  • 2
    Please include relevant code as text, not as images. – Heretic Monkey Feb 14 '19 at 18:01
  • @Vlad you mean "System." references ? in that case all C# projects use them yes – Klue Feb 14 '19 at 18:06
  • @HereticMonkey I did that at first, but there wasn't any color and with the image i was able to add the arrow. I'll try to improve on that ! – Klue Feb 14 '19 at 18:07
  • @Klue: No, I mean the dependencies on native DLLs. Having dependencies on native DLLs could explain the behaviour you see, as 32-bit DLL can't be loaded into 32-bit process. – Vlad Feb 14 '19 at 18:08
  • @Vlad i'm not sure i understand. What project are you talking about ? All C# projects have references to DLLs like System.Deployment.dll (first exemple i saw) if it's what you mean by "native" – Klue Feb 14 '19 at 18:14
  • @Klue: Native DLL is e. g. a DLL written in native languages like C++ – Vlad Feb 14 '19 at 18:27
  • @Vlad oh okay i get it now ! So yes "K005_test" has reference to "SoundSwitch" which has reference to "Audio.Default.Switcher.Wrapper" (a C++ dll) which then has refernece to "AudioDefaultSwitcher" (also a C++ dll) – Klue Feb 14 '19 at 18:33
  • @Klue: Ok that should clear everything. Is AudioDefaultSwitcher a a 64-bit DLL? (https://superuser.com/questions/358434/how-to-check-if-a-binary-is-32-or-64-bit-on-windows) – Vlad Feb 14 '19 at 20:13
  • @Vlad I've set the platform to Win32. But i forgot to mention that i've done some tests to "fix" the dll with a windows command and i got a "not a valid dll" or something (and your tests doesn't seem to work either, i can't find "PE" with the right characters after it) – Klue Feb 14 '19 at 21:04
  • @Vlad update : i've used the basic notepad and i was able to do the test ! it's a x86 file – Klue Feb 14 '19 at 21:12

0 Answers0