I have an existing apllication that run on XP. What do I need to do to make my application to run on Windows 7.
Printable View
I have an existing apllication that run on XP. What do I need to do to make my application to run on Windows 7.
If you are using only .Net classes, avoiding deprecated methods, and not attempting to write to or read from protected memory/disk space, then you should be ok.
Can you please define deprecated method and protected memory/disk space.
What does windows regard as protected memory/disk space?
Deprecated methods or classes are those classes and methods that were released with earlier versions of the framework and have since been rendered obsolete by improvements.
Protected memory/disk space could be directories that you're not allowed to read or write to with current user privileges, protected memory could be memory associated with another process.
My program write settings into the registry (localmachine/software/myappname), and also write to a database and directory in my program folder under programfiles.
Will this be allowed if not, is there a way past it?
The software has been in use (code vb6) for the past number of years by about 400 users mostly running XP. We recently migrated to vs2008.
I think if you want to write to those locations then you need to include a manifest file with your program that specifies that it needs to be invoked as an administrator. Its pretty easy to do but means that users might see a prompt every time they use your program asking if they want to allow it to run. If this sounds like a pain then you need to change the way your program works to make it fall in line with what microsoft considers to be good program practices. As far as I see it Program Files, as the name suggests, is supposed to be just for the program's files such as EXEs and DLLs. Any user specific data that needs to be modified should be stored in the user's profile for example.Quote:
My program write settings into the registry (localmachine/software/myappname), and also write to a database and directory in my program folder under programfiles.
Will this be allowed if not, is there a way past it?
One thing to note, if you want to take advantage of new Windows 7 features like Jump Lists, there are built in .NET classes in WPF 4.0 (which comes out in the next couple of months with Visual Studio 2010 / .NET 4.0) that let you do this with ease :)
How do include the needed settings in the manifest file?
The files it saves to the program files folder is temp files the program works with, and then clean-up after use. User responses and results are saved in the database.
I am in the process to re-write the software using the latest technologies, but for now I need to get it running on windows 7 to keep my users happy.
Temp files, by their name, should be saved to the Temporary Folder. This has the added advantage of cleaning itself up after use, even if you don't!
Use System.IO.GetTempPath() to retrieve the path to the temporary folder on the machine. If you replacewithCode:Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
everwhere in your code, you likely won't have to change anything else! Nor will you need administrator elevation, which should be avoided like the plague unless absolutely necessary.Code:System.IO.GetTempPath()
Thanx, it helped.
For purpose of someone else reading this thread, the reference should be
System.IO.Path.GetTempPath()
Now just one more thing how do I edit, and what code should go into the manifest to allow me to edit the registry. For now I don’t mind my user having to give my app permission to continue.
Well its only certain parts of the registry that you cannot edit without admin permissions, so the best way to do it would be to rewrite your program so that instead of storing data that needs to be changed in the HKEY_LOCAL_MACHINE hive, you store it in the KEY_CURRENT_USER hive. Of course if the data in the registry only needs to be read and not modified then you dont have anything to worry about, you can just have your application's installer write the data to the HKEY_LOCAL_MACHINE hive and then the application can just read it from there.
If you do not provide a manifest file at all then I believe Windows 7 will do the same as Vista and will virtualize the registry access for you. What this means is that if your program tries to write to a restricted area like HKEY_LOCAL_MACHINE\Software, then windows will transparently redirect the registry write to a location in HKEY_CURRENT_USER. This feature is intended to be used for older programs that were written before UAC was around so if you are rewriting your app to work with Windows 7 then you should not rely on it and should just try to do things "properly" and write to the unrestricted areas of the registry.
Thanks for the help.
My app relies on writing to the LocalMchine hive. I will change it in my next update, but for now I need to work around it.