Hi there

I'm trying to run a C# program that's divided into two .cs files. More detail and sample code are at the bottom of this question, but lets dive right to the main question!

First of all, then this program takes use of a virtualMIDI driver that is installed through the loopMIDI package. My hunch is that somehow this driver isn't loaded properly in VS.

Now if I open up the Developer Command Prompt and use csc to compile the program it compiles ok and the program runs fine. The command I use to compile is "csc /t:exe /out:myProgram.exe *.cs"

But I need to get this working in Visual Studio Express 2012. So what I've done to compile in VS are the following steps:

  • Start a new console project.
  • Copy the contents of "TeVirtualMIDITest.cs" into my "Program.cs" (the .cs file which gets created with the empty project)
  • Right click on the project in the solution explorer window, and click "add > existing item"
  • Select TeVirtualMIDI.cs


Now the program compiles ok after these steps. But when I run the program it halts. It seems to stop at the following code:

Code:
[DllImport( DllName, EntryPoint = "virtualMIDIGetVersion", SetLastError = true, CharSet = CharSet.Unicode )]
[return: MarshalAs(UnmanagedType.LPWStr)]
private static extern string virtualMIDIGetVersion( ref ushort major, ref ushort minor, ref ushort release, ref ushort build );
The last line to be precise.

I really don't understand why the program compiled with csc runs smooth, while the VS version halts. Seems to me that possibly the driver isn't loading properly in the VS verion.

Is there anything I might be doing wrong?

The sample code I'm trying to run comes from the virtualMIDI library from

The code can be seen here:


Thanks for your time!
Fr*mann Kjerúlf