开发者

.Net Desktop Application with a setup deployment project

开发者 https://www.devze.com 2023-03-23 06:57 出处:网络
I have a small desktop applic开发者_运维知识库ation that contains 4 text files that I will use as configuration files.I added those files to the Application Folder along with the Primary Output for th

I have a small desktop applic开发者_运维知识库ation that contains 4 text files that I will use as configuration files. I added those files to the Application Folder along with the Primary Output for the project.

Everything works great. However, after I install I can not update the text files in the folder where the application is installed.

Is there a setting where I can make this read-write? Or is it more of a Windows permission issue?

If I set the application to look for a folder in the C Drive (i.e. c:\foldernamegoeshere) would that work better? I think it would be better to have the files r/w where they get installed versus having to tell the user to create a folder and then add the files to the folder etc.

Any ideas on how to get it all done using the setup deployment project?


Keep them reaodonly in the app folder and use commonappdata or user-appdata folder for the writable version... when the app starts it check whether the files exists in the writable folders - if not copy them from app folder, otherwise just use them

you can use any of ApplicationData / CommonApplicationData / LocalApplicationData from Environment.SpecialFolder in a call to Environment.GetFolderPath () and then just implement the logic from above...

MSDN reference: http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx


Is your application being run from a citrix client? I have seen this issue happening when the application was installed in "C:\Program Files\" with an administrative account, but then users that execute the application from their profile with no write access permissions to the "C:\Program Files\" run the application. If that is the case then you might need to install the application in a different folder or partition where the user has write access.

Another thing to check is if the text files are not marked as read-only at the moment VS add them to the setup package. Check that the installed text files are not read-only.


There are both All Users and individual Users folders for saving/loading data.

For per-user install the application and text files in the Application Folder, then the application would copy them out to the user profile's ApplicationData folder if they don't exist, and work on them there.

For per machine access, use the Shared application data folder for the text files, and have your application work on them there.

Setup deployment project contains folder settings that allow distribution to all of the destinations mentioned above.

0

精彩评论

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

关注公众号