“Unable to find a version of runtime to run this application” for 32bit app on 64bit Windows

女生的网名这么多〃 提交于 2019-12-23 13:00:52

问题


I am developing a 32bit WinForm app (target: .NET 3.5). My client insists the app be installed into "Windows\System32\clientname" folder and autostarts on startup. Also, the app must be 32bit, so I can't use "Any CPU".

I am developing under Win7 x64 with VS2010 and all versions of .NET are installed. When I start the app I get the message "Unable to find a version of runtime to run this application". On Win7 x86 it works without problem. It's not the app itself and I am 100% sure all the required frameworks are installed.

I know that on a x64 system this folder is not to be used for 32bit apps but as I said: client insists and won't budge.

Before I tell client definitively that it can't be done I want to explore all options. I googled of course and also searched this fine site but nothing helpful for my particular situation came up.

My app spawns another 32bit process located in the same folder. On x64 that didn't work either, of course, but I solved that by using "Wow64DisableWow64FsRedirection" and then copying it to another location to start it from there (which works fine). I have done my homework but I just can't find a solution for starting the main app under x64 and in that particular folder.

Is there one?


回答1:


In an attempt to solve this problem I created two folders on my Win7 x64 machine:

  • C:\Windows\System32\ClientName; and
  • C:\Windows\SysWOW64\ClientName

Next I created a simple x86 WinForms application targeting .NET 3.5. I found that if I copied the executable to C:\Windows\System32\ClientName I got exactly the same error message as you reported.

However, if I copied the executable to both directories, then I could start it from C:\Windows\System32\ClientName, and it worked just fine.

I did not try this, but I suspect that if you have a multi-assembly application, you only need to copy the *.exe file to C:\Windows\System32\ClientName. All of the other files (and the EXE) would then reside in the C:\Windows\SysWOW64\ClientName directory.

This is a bit of an untidy solution, I know, but then again your client's requirement is a bit unusual to start with.



来源:https://stackoverflow.com/questions/8512861/unable-to-find-a-version-of-runtime-to-run-this-application-for-32bit-app-on-6

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