I have a C# .NET Framework 2 application with the following configuration:
<?xml version="1.0" encoding="utf-8" ?><configuration><startup><supportedRuntime version="v4.0"/><supportedRuntime version="v2.0.50727"/></startup></configuration>
Using Assembly Binding Log Viewer (fuslogvw.exe) I get failures like this with .NET Framework 4.0:
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
...
LOG: Start binding of native image System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. WRN: No matching native image found.
Using .NET Framework 2.0 and 4.5 the operation is successful.
I tried: Adding in the .csproj file:
<Reference Include="System.Management.Automation">
Adding this entries in the registry: reg add hklm\software\microsoft.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1 reg add hklm\software\wow6432node\microsoft.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1
Referencing C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll in the project.
Adding
<startup useLegacyV2RuntimeActivationPolicy="true" in the application config.
Any suggestions are appreciated.
Thank you