I have recently upgraded my application from .NET framework 2.0 to .NET 4.0. I am facing a strange problem after upgrade. I am unable to load Microsoft Exchange/Powershell Assemblies.
rc = RunspaceConfiguration.Create(); warning = null;
if (Version == "2010")
info = rc.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out warning);
One of the exceptions are:
[Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.][1]
The code works absolutely fine in .NET 2.0. I am unable to understand the cause of the problem. But with reference to this article,I have concluded that this is a bug. Please suggest the soultion.
Thanks in advance