I have a .NEt 3.5 C# program written using VS2008 that uses a SQL Server CE database. I also have an installer for the program which I have created using the Visual Studio setup project type.
Within the program designer, the database file is included as type "content".
Within the installer program, the output for "content files" is the application folder.
This works fine on XP, but under Vista an error occurs when attempting to run the program. The error is that the program does not have permission to access the database file.
How do I fix this? Is there "proper" way to set this up in the installer project? Or do I need to write additional code in the application project? Do I need two different installer projects, one for XP and one for Vista? (Or 3, one for XP and one each for 32 and 64 bit Vista...).
And what about Windows 7, is that different again?
I am finding this very frustrating, as I only have an XP machine on which to develop and test.
T.I.A.
Loading
DonPosted Feb 28, 2010, 10:31 PM
DonPosted Feb 28, 2010, 8:23 PM
I tried the following changes:
In the application, I load the datacontext from the common applicaton data folder instead of the porgram files folder:
db = new FDDB.FDDB(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\" + Application.ProductName + "\\FDDB.sdf")
In the setup project I created a custom folder on the target machine with the following properties:
DefaultLocation = [CommonAppDataFolder]\[ProductName]
Property = COMMONAPPDATAFOLDER
I then attempted to run my program on my XP machine with a user who is only a member of the "users" group.
The application fails when database access is attempted. The error is "access to the database is not allowed".
So the only folder that seems even remotely "correct" according to the microsoft documentation still doesn't work. Is anyone able to provide a concrete answer to this other than telling me to refer to documentation that doesn't exist?
Sam HobbsPosted Feb 28, 2010, 11:36 AM
Also see Special Folders and Custom Folders and Environment.SpecialFolder Enumeration. Also Inside Windows 7:Introducing Libraries appears relevant.
DonPosted Feb 27, 2010, 11:35 PM
Sam HobbsPosted Feb 27, 2010, 7:46 PM
Perhaps you need to get a book about software security; there are not many but there is at least one. Don't try to ignore security and just use Administrator rights to bypass the issure.
DonPosted Feb 27, 2010, 1:37 PM
Kirtan PatelPosted Feb 27, 2010, 4:33 AM
DonPosted Feb 27, 2010, 2:00 AM
Kirtan PatelPosted Feb 27, 2010, 1:15 AM
hope it can solve your problem .