Goal: I would like to build a Winform application which can support x86 and x64. Normally, there is no problem if I build x86 only but
A function of this Winform application depends on licensed external library that which some users installed x86, some user installed x64 version, and some user install both --> If I set my Winform application as x86, it will try to run x86 on licensed external library --> error
Winform application uses a SAP Connector 3.0 library which SAP ships the library in 2 different package x64 and x86
Workaround/Current method: I do everything in x86 with SAP x86 library --> copy project --> change x64 --> change SAP reference to its x64 library
This causing more works + the application changes quite often and I wish I could just build 1.
What I have tried: I followed this Q-A Resolution of correct x86/x64-dlls at runtime
(1) I got exited with code 4
when I try add this to post-build (also pre-build) events
xcopy /E /H /R /Y /I /D $(SolutionDir)\x86 $(TargetDir)\x86
xcopy /E /H /R /Y /I /D $(SolutionDir)\x64$(TargetDir)\x64
I am not sure if this is problem: I also use SQLite in my application and it already has 2 folders x64 and x86 created at the release directory.