Share via


How to make a C# Project work on Windows XP

Question

Wednesday, August 27, 2014 8:06 AM

Hello,

I am developing a C# Project using the Microsoft Visual Studio 2012 Express for Windows Desktop. I am developing on Windows 7 but the application has to run on Windows XP as well.

The Problem is, it won't run on Windows XP. I get the Errorlevel 5 which is an Access Denied Error as I found out. I searched the Internet for an answer but couldn't find anything that would help. I am using the .Net 3.5 Framework which is also installe don the Windoes XP Computer. I should also mention that the Software works perfectly on Windows Server 2003 (32 Bit).

There is no exception during the runtime or anything like that. As soon as you start the executable an errormessage Pops up which says "Is not a valid Win32 Application". As there is no Special Code Segment causing the Problem I can't post any code. 

Best regard
Marius

All replies (10)

Thursday, August 28, 2014 10:23 AM ✅Answered | 1 vote

Well, you can't expect that something you complied on the Windows 7 platform and deployed to a XP machine is going to work. And it's not working for you. Win 2k3, XP and Win 7 each in thier own rights are different versions of the Windows O/S with different versions of the core components  You are lucky that the solution is working on Win 2k3.

What all this means to you is that you complie, build and the deploy the solution on the platform it is intended to run on. If you want the solution to run on XP, then you need to compile it on the XP platform and make sure it works, and then you deploy it to the XP machine. You don't compile it on the Win 7 platform and think that said executable is going to work on XP.

Thanks to you I tried to Import the Project to Visual Studio 2010 as this is the latest supported Visual Studio Version on Windows XP. As I found out, compiling the Project on VS 2010 was all I had to do to make it runnable on Windows XP.

So all you have to do, to make a Visual Studio Project run on Windows XP is using Visual Studio 2010.


Wednesday, August 27, 2014 8:13 AM

Hi Solitune,

1. you need to create your .NET-Project as .NET 4.0 (later versions are not supported on Windows XP).

2. Install .NET 4.0 on your XP-machine

3. Run and enjoy.

Thomas Claudius Huber

"If you can't make your app run faster, make it at least look & feel extremly fast"

My latest Pluralsight-course: Windows Store Apps - Data Binding in Depth

twitter: @thomasclaudiush
homepage: www.thomasclaudiushuber.com
author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook


Wednesday, August 27, 2014 8:15 AM

Thanks for the quick answer, but I updated the question at the Moment you answered. I already checked the .Net Version. I am Using .NET 3.5 so this cannot be the reason for the Problem.


Wednesday, August 27, 2014 9:56 AM

Choose Project > Properties.

In the Application tab.

Double check you are compiling for the .Net framework you have installed on the target machine.

Click on the Build tab

Check your Platform Target is Any CPU

and Prefer 32 bit is checked

Hope that helps
Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


Wednesday, August 27, 2014 10:14 AM

Choose Project > Properties.

In the Application tab.

Double check you are compiling for the .Net framework you have installed on the target machine.

Click on the Build tab

Check your Platform Target is Any CPU

and Prefer 32 bit is checked

Hope that helps
Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.

I already did that- That's how I got the application to run on Windows Server 2003. But it doesn't help with Windows XP


Wednesday, August 27, 2014 10:25 AM

I suggest you try explicitly compiling for x86 then.

Hope that helps
Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


Wednesday, August 27, 2014 11:47 AM

I suggest you try explicitly compiling for x86 then.

Hope that helps
Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.

Tried that before - unfortunately it didn't work.


Wednesday, August 27, 2014 3:00 PM | 1 vote

Well, you can't expect that something you complied on the Windows 7 platform and deployed to a XP machine is going to work. And it's not working for you. Win 2k3, XP and Win 7 each in thier own rights are different versions of the Windows O/S with different versions of the core components  You are lucky that the solution is working on Win 2k3.

What all this means to you is that you complie, build and the deploy the solution on the platform it is intended to run on. If you want the solution to run on XP, then you need to compile it on the XP platform and make sure it works, and then you deploy it to the XP machine. You don't compile it on the Win 7 platform and think that said executable is going to work on XP.


Wednesday, August 27, 2014 3:13 PM | 1 vote

You could explore that theory.

Assuming that's win 7 pro you have there.

There's win xp mode which is a virtual machine.

http://windows.microsoft.com/en-GB/windows7/install-and-use-windows-xp-mode-in-windows-7

You can install vs2012 express on that virtual xp machine.

Or  maybe just msbuild if you're confident with that.

Compile.

That'll then give you an xp compiled version.

Give that a go.

Hope that helps
Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


Thursday, August 28, 2014 12:00 PM

Thanks to you I tried to Import the Project to Visual Studio 2010 as this is the latest supported Visual Studio Version on Windows XP. As I found out, compiling the Project on VS 2010 was all I had to do to make it runnable on Windows XP.

So all you have to do, to make a Visual Studio Project run on Windows XP is using Visual Studio 2010.

I am glad it worked out for you.