The Fate of Tyrlon and other Dubious Things

A chronicle about life, software development, games and whatever else I come up with!

The Fate of Tyrlon and other Dubious Things header image 2

.Net framework - Vista and XP Cross-Compatibility

September 24th, 2008 · No Comments

This is sort of a rant since i’ve been running into this issue with one of my programs lately (DeedCAD), but you would think that the .Net framework would allow for .net applications to run on Windows Vista and Windows XP equally well.  If you thought this, you would be incorrect.

Windows Vista does a lot of things differently than Windows XP and this can come back to bite you in the tail but I do have a few suggestions if you are trying to ensure cross-compatability between both operating systems.

1. Test your application while running as a limited user in Windows XP (instead of the administrator accounts that nearly all of us login as).  This will give you a better idea of what things in your application might cause permissions issue in Vista where the default behavior is to run as a limited account and elevate to admin only when necessary.  What is rather silly is that the error messages you might get in Vista from this problem may not be that informative in letting you know that it is because your application isn’t running as an administrator.  A quick way to test this would be to test forcing the application to run as an administrator in Windows Vista (right click the shortcut and choose advanced - there is an option there to run as administrator) and if everything works fine at that point you know some aspect of your program is needing administrative priviledges.  This can almost always be worked around such that you don’t need the elevation and that is the desired behavior for applications on Vista.

2.  Don’t store user data in your program’s base directory.  Windows Vista likes things to be stored nice and neatly in Application Data folders.  The reasoning behind this is that in Windows XP technically you weren’t supposed to be writing data to Program Files\ folders since they were meant to be read-only.  However, since everyone is running as an administrator in XP it ignores that and writes to it anyway.  In Windows Vista they are enforcing this more, but still allowing writes to the Program Files to be allowed through the usage of a virtual folder for compatibility issues.  If they didn’t allow that numerous XP programs would break when they found themselves unable to write to their running folder.  The Application Data folder exists in XP as well, so there is no issue with changing your code to do the same thing in both Vista and XP in this case.

3. If you absolutely must run your application as an administrator, save your user the trouble of figuring that out and change your manifest file such that it requests administrative priviledges to run (this will result in the dreaded User Account Control pop-up asking to elevate to admin).  You can find directions on how to do that over in this helpful blog post.

4.  Another thing that will help Vista compatibility is to switch from Visual Studio 2005 with .Net Framework 2.0, to Visual Studio 2008 using .Net Framework 3.5.  2.0 was really designed with XP in mind and .Net 3.0 and 3.5 were built on top of this while adding additional support for Vista.  Since Vista is natively using 3.5, switching your application such that it is natively encoded into 3.5 should help some with compatability issues.  Windows XP supports .Net Framework 3.5 as well, so this shouldn’t be an issue - just make sure to distribute that version of the framework with your application.

5.  Get the latest service pack for the framework.  There was a recent service pack that came out in August 2008 that addresses numerous issues and is a cumulative update for .Net 2.0, 3.0, and 3.5.  You can download that update here.

Let me know in the comments if you’ve found any other useful tips for getting .Net applications to work on Vista the same as they do on XP!

Share and Enjoy!
  • StumbleUpon
  • Digg
  • del.icio.us
  • Technorati
  • Fark
  • Slashdot
  • Facebook

If you enjoyed this post, make sure you subscribe to my RSS feed!

Tags: Software Development · Tips

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment