开发者

EntityException: Access to the database file is not allowed

开发者 https://www.devze.com 2022-12-24 22:22 出处:网络
I am w开发者_高级运维orking 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 Micr

I am w开发者_高级运维orking 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消