0
votes

My C# rdp client use AxInterop.MSTSCLib ActiveX in a Form. I want to package mstscax.dll together with my application. Microsoft has dll redirection and side-by-side tech to resolve dll hell problem. I have tried dll redirection by creating a RDPClient.exe.local file but no effect. I have found some examples of manifest but they're all used in c++ projects. How to create a manifest in C# vs2019 project to limit the mstscax.dll search path of AxInterop.MSTSCLib?

I've only done this for VB6 executables, not C#. Have you googled / read articles like the following? weblog.west-wind.com/posts/2011/oct/09/…StayOnTarget
@UuDdLrLrSs According to the article, I set isolated=true on AxMSTSCLib&MSTSCLib, then vs2019 generates a manifest file and copy mstsxax.dll to my bin/x64/Debug output directory. When I run my exe in debug mode by vs2019, a System.BadImageFormatException occurs and the StackTrace shows exception is at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)Acewind
I check the file mstscax.dll in output directory, it has a deferent size and detail info to C:\Windows\System32\mstscax.dll. Where is it from? I try copy C:\Windows\System32\mstscax.dll to output directory and run my exe again, the same exception occurs.Acewind
You may have more than one copy of that DLL on the PC, and the one in system32 is not the one that was registered. Easiest thing is probably to do a filesystem search. Then unregister all copies, and finally register just the correct one. (Using regsvr32, probably)StayOnTarget
If you rely on the manifest, I think you must copy the DLL to the output dir, AFAIKStayOnTarget