<p>I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch device emulators. When I call <code>device.Connect()</code>, I inexplicably get a DirectoryNotFoundException. I get it if I try it in PowerShell or in C# Console Application. Here's the code I'm using:</p>

<pre><code>static void Main(string[] args)
{
     DatastoreManager dm = new DatastoreManager(1033);
     Collection&lt;Platform&gt; platforms = dm.GetPlatforms();

     foreach (var p in platforms)
     {
        Console.WriteLine("{0} {1}", p.Name, p.Id);
     }

     Platform platform = platforms[3];
     Console.WriteLine("Selected {0}", platform.Name);

     Device device = platform.GetDevices()[0];
     device.Connect();
     Console.WriteLine("Device Connected");

     SystemInfo info = device.GetSystemInfo();
     Console.WriteLine("System OS Version:{0}.{1}.{2}",info.OSMajor, info.OSMinor, info.OSBuildNo);

     Console.ReadLine();
}
</code></pre>

<p>Does anyone know why I'm getting this error? I'm running this on WinXP 32-bit, plain jane Visual Studio 2008 Pro. I imagine it's some config issue since I can't do it from a Console app or PowerShell.</p>

<p>Here's the stack trace:</p>

<pre><code>System.IO.DirectoryNotFoundException was unhandled

Message="The system cannot find the path specified.\r\n"

Source="Device Connection Manager"

StackTrace:
       at Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManServerClass.ConnectDevice()
       at Microsoft.SmartDevice.Connectivity.Device.Connect()
       at ConsoleApplication1.Program.Main(String[] args) in C:\Documents and Settings\Thomas\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs:line 23
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
</code></pre>

[{'answer_id': 6928, 'author': 'Kev', 'author_id': 419, 'author_profile': 'https://Stackoverflow.com/users/419', 'pm_score': 0, 'selected': False, 'text': "<p>I tried this and it works ok. Can you paste in the whole exception and stack trace?</p>\n\n<p><strong>Updated:</strong> Strangely I can't find that interop assy on my machine either other than under the c:\\windows\\assembly\\GAC_MSIL folders.</p>\n\n<p>Why not fire up SysInternals FileMon or Process Monitor, it'd save some guesswork.</p>\n"}, {'answer_id': 6934, 'author': 'ageektrapped', 'author_id': 631, 'author_profile': 'https://Stackoverflow.com/users/631', 'pm_score': 0, 'selected': False, 'text': "<p>I suspect there is a problem with my Microsoft.VisualStudio.DeviceConnectivity.Interop assembly. There is no copy of that on disk that I can find. It's in the GAC only. I tried to inspect in Reflector, but it needs that Interop assembly also. Since ConManServerClass is obviously COM, maybe there's a COM library that has to be registered?</p>\n"}, {'answer_id': 10534, 'author': 'ageektrapped', 'author_id': 631, 'author_profile': 'https://Stackoverflow.com/users/631', 'pm_score': 1, 'selected': False, 'text': '<p>Installing VS 2008 SP 1 fixed it for me.</p>\n'}, {'answer_id': 2401184, 'author': 'PrateekSaluja', 'author_id': 307989, 'author_profile': 'https://Stackoverflow.com/users/307989', 'pm_score': 2, 'selected': True, 'text': '<p>It can be found at <code>&lt;systemdrive&gt;:\\Program files\\Common Files\\Microsoft Shared\\CoreCon\\1.0\\Bin</code>.</p>\n\n<p>This is the path where you can get this dll, so add this dll to your project.</p>\n'}]
['https://Stackoverflow.com/questions/6904', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/631/']