Tuesday, August 05, 2014

AppV 5 - .NetFramework applications that only work with 32bit .NetFramework architecture

I encountered an issue with an application of ours that refused to launch on Windows 2008 R2 SP2 but worked on Windows 2003 R2.  I did a procmon.exe trace and noticed some discrepancies in the trace results:

^^ 2008 R2 SP2 (non-working application launches)

^^ 2003 R2 (working application launches)

So, my application was defaulting to the .NetFramework64 architecture and no launching.  To correct this I was able to run this command:

If you have a 64 bit machine and want to run a .NET application that only works with the 32 bit CLR you would have to make changes to the .NET framework on your machine
Set the .NET framework to load the CLR in WOW mode through this command
Open up command prompt and type this command
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe SetWow
Now you should be able to run apps that use only the .NET 32 bit CLR.
To revert back to the default 64 bit framework run
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe Set64

It appears all this does is modify one registry key:
REG_DWORD Enable64bit
DATA 0x0 (for SetWow) 0x1 (for Set64)

Alternatively, run corflags.exe against your executable to force it only utilize the 32bit .NetFramework.  Corflags.exe can be gotten from the ".NET Framework 2.0 Software Development Kit (SDK) (x64)"
Execute the application with the following:
“c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\CorFlags.exe” MyApplication.exe /32bit+

After doing so your application should only use the 32bit .NetFramework.  And, if you are in my scenario, the app now works without issue.


It appears the following registry key is for status only:

REG_DWORD Enable64bit
DATA 0x0 (for SetWow) 0x1 (for Set64)

It does not actually do anything configuration-wise. Changing this key does not manipulate the ability to .NetFramework to use 32bit or 64bit.

No comments: