TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
hedgert
NA
1
0
Writing to the file system from a service
May 15 2005 5:46 AM
I have working code for an application that uses a configuration file. Periodically the application does work and saves updated information to the configuration file. All is well when I use a conventional console project for my application. When I turn into a service, I have problems. With hard coding of directory paths I can make it all work, but when it comes to deployment it looks like all the pieces are there but they don't quite hang together. In my setup project I can create registry entries to be set on installation but I can't seem to create a registry entry to point at a location I can use to write file to (without hardcoding the registry entry). In my setup project I can put my original config file into a deployment directory in the file system but not one I can point at without hardcoding the registry entry. I find that I can't overwrite the configuration file I deploy, so I've set my app to read the original config and then write to a new file name - that seems to work OK, but if there's a way round this I'd be interested. I've found (by experiment - as I can't find guidance on which bits of the file system a service/deployed program can write to/read from) that I can read files and write to non-deployed files in the application data area. But I don't seem to be able to refer to the same application data area in code and at deployment time (e.g. I can get at user in one and all users in the other). Can anyone help? My requirement is: 1 write a config file with the installation whose path I can put into the registry at deployment time 2 read and rewrite either that file or one with a new name at run time from my service (using the location in the registry) (i.e. I'm not attached to Application Data areas - although that seems like the logical place to do this from - I just want somewhere in the file system that I can deploy and write to!) And of course I want to avoid hardcoding - i.e. do it properly!
Reply
Answers (
0
)
Performance Concerns on deployment
Conditional deploy of shortcuts using C#/Visual Studio 2005 Beta