Thursday, July 1, 2010

If your VB.NET Application won't run on Windows 7

Despite being primarily a web developer, every now and then at my office, I need to create small little Windows Form based applications that perform one or two simple tasks to help out the every day processes of the staff.

Recently a couple people at our office were upgraded to Windows 7, and have experienced issues with those Visual Studio 2008 based applications, either during installation or running them after installing.

After some investigation, I stumbled upon the cause of the problem and a solution. Whether it is the machine or the operating system or gremlins sneaking around in this guy's new computer; for some reason, code compiled to work with the Target CPU value "AnyCPU" won't run on this machine.

To correct the issue, I opened the project settings in Visual Studio and clicked through to the Advanced Compiler Settings:
Project -> Compile -> Advanced Compile Options

Change the "Target CPU" field to "x86" and click OK.
Publish your application and it should install and run on the Windows 7 computer now.


Windows 7 Visual Studio 2008 Project Settings Target CPU

0 comments:

Post a Comment