0

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

  1. 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

  2. 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.

Cleptus
  • 3,446
  • 4
  • 28
  • 34
Secret
  • 337
  • 4
  • 11
  • Is the missing space in the last line a typo? – Steve Apr 10 '19 at 13:05
  • 1
    Did you try to use the Configuration Manager and create two configurations? One for x86 with the x86 references and one for x64 for the x64 references? – Steve Apr 10 '19 at 13:09
  • @Steve - yes, it was a typo, accidentally when I tried to make post nicer. – Secret Apr 10 '19 at 13:11
  • @Steve - that what I am current doing that but I have to re-reference the SAP library manually when there is code change. – Secret Apr 10 '19 at 13:15
  • @Steve - I just found out that I could manually copy the SAP dlls to x86 and x64 to the "Any" release folder, at least I will not need to build 2 different projects (x64 and x86) – Secret Apr 10 '19 at 13:24
  • 1
    Look in the Output window for the actual error message that xcopy produced. "Access denied" would be likely, temporarily disable the installed anti-malware product to see if that's the cause. Or whatever "copy protect" did to prevent copying. – Hans Passant Apr 10 '19 at 13:36

0 Answers0