简体   繁体   中英

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

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?

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.

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