Why can't I run my exe in system32?

家住魔仙堡 提交于 2019-12-06 09:05:08

问题


I made a program and compiled it. It works as expected in the debug folder. I took it out and put it in system32 but it wont run. It gives this error:

.NET Framework Initialization Error
Unable to find a version of the runtime to run this application.

I've tried putting it in it's own folder inside the debug folder and it worked without the other debug files. I've tried running it as an administrator. I know I have the correct .NET Framework version because it is able to run outside of system32. I've tried to run it from somewhere else using the command prompt. I've tried all that but it still doesn't work.

EDIT: I've also tried putting the exe in the windows folder.


回答1:


This problem is due to the architecture build of the exe x86 vs. x64. The default compile in VS2012 is ANYCPU with prefer x86 ticked.

If your build is as default on a x64 platform it should be copied to c:\windows\syswow64 which is the 32 bit system32 folder. Or the application should have the prefer x86 option removed and be recompiled.

Either way its not a case of you not having the correct framework installed, it is due to Windows on Windows behaviour and compile configuration.

Hope this helps!



来源:https://stackoverflow.com/questions/12993739/why-cant-i-run-my-exe-in-system32

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!