问题
My small application does 2 things seem conflict:
1) Use VFPOLEDB.1 to talk to Visual Foxpro database to get some data --> It require app builder in x86 or 'Any CPU'
2) However there is another function to call a powershell script to access IIS of the server and it requires project build in x64. (or when .Net launch powershell, it gets confused about which version and will throw some COM object class not register error)
How can I handle this conflict issue?
回答1:
I'm not entirely sure, but perhaps you can do this by splitting your project. One project is x86 and does the FoxPro call, the other one is x64 and calls Powershell, a third one would be the main project that calls the two.
回答2:
Per Microsoft:
The VFP oledb driver is 32 bit and can not be used with the NET 2.0 CLR running in 64 bit mode. It is my understanding that there are no plans to provide a 64 bit version of the VFP oledb driver. [Source]
In short, you're not going to ever be able to use it in 64-bit mode; work out trying to solve your COM object error and build for x86. Your other option might be to generate a standalone executable for the FoxPro section and have your main app execute it independently (it would end up being virtualized though).
回答3:
I think another option for this would be to use COM+ and a late-bound execution model, where the COM objects are actually managed by a COM+ server rather than your application directly.
来源:https://stackoverflow.com/questions/20556220/how-about-net-project-needs-to-build-under-both-x64-and-x86