I am working on a Visual Sudio 2010 Setup Project to install an Entity Framework / SQL Compact app. The app needs to install an SDF file on the user's machine. As I understand the Microsoft guidance, I should install the SDF file to a company\application subfolder under C:\ProgramsData on the user's machine, which I have done in the setup project by creating a custom folder in the File System Editor with a DefaultLocation property of [CommonAppDataFolder]. All works well, and the SDF file is installed to C:\ProgramData\MyCompany\MyApp\MyFile.sdf.
Here is my problem: On the client machine, my app is throwing an EntityException with the following message: "SqlCeException: Access to the database file is not allowed." Sounds like a permissions issue.
Is there a way to set permissions on the SDF installation folders from within a VS Setup project? How would I do it? Any examples? Thanks for your help.
The answer is to create a small DLL that gets executed as a Custom Action by the Visual Studio Setup Project. There is a walkthrough on creating Custom actons here.
Related
I have created a Windows application in which I have used a SQL Server CE database. Further, I have used Wix installer to create installer for this application.
After installing application, when I run application as administrator, everything is fine.
But when I run application without administrator privileges, I get an exception:
Access to the database file is not allowed
I want to know the procedure to add the .sdf file into Wix installer so that it creates a separate folder below the AppData folder, and places the .sdf file there.
Any help will be highly appreciated.
Thanks
Consider creating the file in code, either by embedding as resource or just create using SqlCeEngine.CreateDatabase
In my windows application, there's a file (option.xml) created by my application on the user's computer. It's created run-time with option selected by the user.
This file is in the bin directory.
When I make a new release, the installation (that I make publishing to a shared directory with visual studio wizard) delete this configuration file, so the user have to save the option again.
How can I publish a new release without delete this file?
I'm using visual studio 2013
I hope that the issue is clear.
thanks
I have created a visual studio setup project that writes content files to User's Application Data Folder
C:\users\user\AppData\Roaming\CompanyName
I did this By adding User's Application Data Folder in File System on Target Machine link from setup project and adding content files to that folder.
When I install this setup it installs only for one user(active). I want this to install content files to all users AppData folders
Example folder locations:
1.C:\users\user1\AppData\Roaming\CompanyName
2.C:\users\user2\AppData\Roaming\CompanyName
How to install these content files to each and every user's AppData folder on the machine using Visual Studio Setup project.
Any help is greatly appreciated.
The short answer is that you can't. There's no way of enumerating all those folders and installing files to them, and that won't work anyway if a user account gets created after your setup has been installed.
The good news is that it should just work. Assuming your installed app has a shortcut to the program, and the setup was installed for Everyone, log on as another user and use the shortcut. What should happen is that Windows will notice that the user doesn't have the files and it will ask for the original MSI file to install them. This works even if the user account wasn't present at the time of the install, and will happen just once per new user of the app to install the files.
I have developed a winform application in Visual Studio 2010. I created a setup project to make the install of the app.
When I install the app and I choose a drive like D:\MyAPP I have no problem and I could ran my app without problems, but when I install the app in c:\program files\MyAPP I have problems because the folder and the files in it doesnt have all permission for all users, so an example is that I cant write in the database file (sqlce).
Is there anything I can do? Is there a configuration on the setup project ? can I give all permission to all users over the folder intallation and its files?
Thanks
"Permissions on c:\Program files" is a Vista/Win7 thing. Here's a good link:
http://www.vbforums.com/showthread.php?564256-Classic-VB-Where-should-I-store-the-files-that-my-program-uses-creates
I am running Visual Studio 2010 and I created the default MVC3 sample project. The project starts fine and I get the home page.
But when I go to register a new user I get this error,
An error occurred during the execution of the SQL file 'InstallCommon.sql'. The SQL error number is 5177 and the SqlException message is: An unexpected error occurred while checking the sector size for file 'D:\WORK\VISUAL STUDIO PROJECTS\VISUAL STUDIO 2010\MVC3\MVC3\APP_DATA\ASPNETDB_TMP.MDF'. Move the file to a local NTFS volume, where the sector size can be retrieved. Check the SQL Server error log for more information.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Creating the ASPNETDB_af8cb88b53744229b5d3dca30395b572 database...
I also have SQLServer 2008 R2 installed.
Does anyone know why this is happening?
Thanks
I had the same problem. It is trying to create a database 'D:\WORK\VISUAL STUDIO PROJECTS\VISUAL STUDIO 2010\MVC3\MVC3\APP_DATA\ASPNETDB_TMP.MDF' and failing to create it. Firstly check if the file already exists and manually delete it if so. For me, it was because I was creating a drive using the Windows command:-
subst x: "e:\My Work"
And my solution was on X:, which for some reason the app did not like. You can also try creating the database 'D:\WORK\VISUAL STUDIO PROJECTS\VISUAL STUDIO 2010\MVC3\MVC3\APP_DATA\ASPNETDB_TMP.MDF' manually in Visual Studio and see if you get the same error.
If you can't create it, look at the drive/folder settings such as make sure it is NTFS drive and check rights etc.
For me, the problem was caused by the disk mapping, I have mapped a folder C:\abc as a virtual disk, then the error occurred while I run app from the virtual disk, move the projects outside of the virtual disk solves my problem.
you need to have express edition installed, generally to run the programs which we download from online. or else if you have developer edition or enterprise edition of SQL installed you need to change the connection string in web.config to you database and before that don't forget to copy database form APPData folder to you database.
Hope this should work.