Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Net 4 application won't run on Win XP SP3

Status
Not open for further replies.

MakeItSo

Programmer
Oct 21, 2003
3,316
DE
Hi guys,

I'm having a bit of a problem here. I write tools for various tasks and want to enable other people to use these tools, too.
Alas, for various reasons some people still need to work on Win XP machines (SP3, .Net 4 extended + client installed) - and my tools fail to run on these machines.
I am currently trying with one fairly simple Windows Forms application.
Background info on what I've attempted to make it work:
[ul]
[li]set config to x86 instead of 64 bit[/li]
[li]made sure Framework 4 (not client) is selected as target[/li]
[li]switched from VS 2012 to VS 2010[/li]
[li]set target consecutively down to Framework 3.5, 3, then 2[/li]
[li]for downgrading, removed unused references to Linq, Threading and Microsoft.CSharp[/li]
[li]reduced .ico size from 256 to 64 px[/li]
[li]replaced the .png displayed on the form(s) with a .jpg[/li]
[/ul]

Still to no avail. The tool will compile and run nicely on Win 7 machines but will fail on Win XP SP3 (i.e. will not start up "xyz has encountered a problem and will quit").
At first it wouldn't even display the icon for the .exe, that has been solved by the second-to-last step.

I am not using any third-party assemblies, all native .Net.
Functionalities used in the application:
- ListBox and TextBox with drag/drop
- Regular expressions
- XML DOM handling (no Linq)
- StreamReader/Writer
- small PDF embedded as Resource (manual)

References: System, System.Core, System.Data, System.Deployment, System.Drawing, System.Windows.Forms, System.XML
+ using: Colections.Generic, Componentmodel, Text, Text.RegularExpressions

Running out of ideas here.
Anyone know what's cooking?

Thanks & regards,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
A little update on this:
I have installed Upgrade 3 for VS 2012 - no result.

Another rather curious thing: I am using a reg query to determine whether .Net is installed and which version:
Code:
reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP" /s /v version | findstr /i version | sort /+26 /r

Running this on any XP SP3 machine gives an error message "too many command line parameters".
Does this ring a bell with anyone?

Thanks & regards,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
SOLVED!!!
[peace]

Using about a dozen try-catch blocks and writing exception + position to an errordump file, I managed to locate the problem:
The app crashes on resources.GetObject("$this.Icon") in the InitializeComponent method of the Form Designer.
By default, VS generates a line like this:
Code:
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

Works fine on Windows 7 but not on XP!

I solved this by importing the icon file into my Resources, then replacing this line in Form Designer with:
Code:
this.Icon = global::[mynamespacegoeshere].Properties.Resources.[COLOR=#EF2929]logo[/color];
Where "logo" is the name of your icon resource.

MS <XOR> logic... [poke]

I hope it'll save someone else's nerves one day...

Cheers,
MakeItSo


“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Ahem...
I just learned that InitializeComponent must not be edited manually...
[blush]


Ergo: no direct assignment of logo, but instead:
Code:
private void Form1_Load(object sender, EventArgs e)
        {
            this.Icon = [mynamespace].Properties.Resources.logo;
        }

*sigh*

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top