简体   繁体   中英

Problem with compilations projects in x86 and x64

I work with the application that has to be run in 64 bit Windows and I use OCX control that should be run in 32 bit emulation mode. I can embed this control in Windows Forms Control Library and then add reference to this library to main application in order to set another emulation mode for this control and another for whole application, but it generate another problem. In this case I get an error "Exception of type InvalidActiveXStateException was thrown". I tried to use this Windows Forms Control Library with the project that was also run in x86 and everything was ok.

Do you know in which way I can run application which contains two or more projects that one project would be run in x86 and one in x64? (Right know when each project is in another mode it can't find some assemblies)

You can't mix 32 and 64 bit code in the same process. If you absolutely must run this 32 bit control from a 64 bit app then you'd need to do it as an out of process server. Whilst this is probably feasible I don't believe it to be trivial.

Anyway, you may very well not need to do this. Since 64 bit Windows runs 32 bit apps you can make sure that your app targets x86 instead of AnyCPU and then it will run on 64 bit Windows.

I'm not very sure if this is what you're looking for, but you can create two projects for any of your current projects.

Source code lives in one of the pairs and so on, and the X64 or X86 adds all files using Visual Studio symbolic links.

Then, you don't need to maintain duplicate code and you'll only need to configure one project for X86, and the counterpart for X64 and so on.

Symbolic links are created when you try to add an existing item, and you press in the arrow and you choose "add link".

I found that this is not a solution for you (and almost wrong). Thanks to commenters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM