Compiling C# GUI for win XP from a Windows 7 / VS2010 Dev Platform
I'm currently developing a simple C# GUI in Visual studio 2010 Pro on a Win 7 X64 pc. My problem arises when I try to run the application on different PC's. The builds seem to work fine on all Win 7 machines however my release builds for x86 instantly fail when trying to execute the .exe on Win XP 32bit machines.
I thought C# was an interpreted language that would run on any machine running the current version of .net. My source code is utilizing some of the .net libraries such as "System.IO.Ports" (SerialPort mainly) some 开发者_Python百科functions from the "System.Linq" library as well as a "BackgroundWorker"
Are there any known issues for compiling for different platforms or some settings I have to have correct in the project properties page to have a runnable application on Win XP 32bit?
Have you installed the .NET Framework 4.0 on the Windows XP PC?
Also, you can target earlier versions of .NET with Visual Studio 2010 if deploying .NET 4.0 is undesirable for whatever reason, and assuming your application doesn't use any .NET 4.0 features.
See this MSDN article for more information.
Have you changed your build target from Any to x86 (32 bit) only?
What is the full error message you are seeing?
My guess: you need to install .net 4.0 on those XP machines to get that executable to work.
C# executables run inside a virtual machine, but that virtual machine is not necessarily installed on all target machines. In the case of VS2010, it targets the latest version of .net, 4.0, which will often not be present on older XP machines.
Your VS2010 will have come with re-distributable packages for .net 4.0 so it should be easy enough to push them out to wherever's needed. However, exactly how you do that all depends on your local arrangements.
精彩评论