简体   繁体   中英

Force C# app to compile as x64 instead of AnyCpu

I've being driven up the wall trying to reference native x64 dlls in a C# app, using C# 2010 Express. I have a demo project that was converted from a 2008 project that has configuration and platform options in its properties, but the new projects that I've created don't! The dropdowns just don't exist - in fact I can't even switch from Debug to Release. Both of them use .Net Framework 4 and everything else seems the same between them.

In C++ and the converted C# project it's simple, you just open the solution's Configuration Manager and go, but my new C# project doesn't have that in the context menu.

I need to be able to reference the x64 dlls under x64 and the x86 dlls under x86, due to massive memory requirements. Can anyone explain why the option is missing or point me to how to fix it?

Select Build - Configuration Manager. Under the Platform select new, then select x64 there.

To make the project runtime configurable, first learn how to load an assembly at runtime, as in: http://support.microsoft.com/kb/837908

Use IntPtr.Size to determine which platform you are using, as in: http://msdn.microsoft.com/en-us/library/ms973190.aspx

Use a factory with the IntPtr.size parameter to obtain the correct dll, as in: http://www.go4expert.com/forums/showthread.php?t=5127#abfactory

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