Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 648139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:47:59+00:00 2026-05-13T21:47:59+00:00

I am using ClickOnce deployment for a Windows Forms application and I need configuration

  • 0

I am using ClickOnce deployment for a Windows Forms application and I need configuration information on a machine basis that persists across deployments and across user profiles. As such, per user configuration does not help. I would also like the configuration file to be easily accessible with a text editor in a well known location on each machine (well known, that is, by the organization).

The problem I have is that ClickOnce overwrites the app.config on each deployment. I am aware of the configsource attribute, but from what I understand, the target file has to be in the path of the application – that means that I can’t control the location effectively.

So I created a class for the data I want to persist and am serializing / deserializing it to and from the location I want. This all works well, except that if the file doesn’t exist I am creating it (using XmlSerializer and a TextWriter). The problem here is that the user that is running the app when it is created becomes the only user that can access it. Subsequent users do not have permission unless I grant permission to a broader AD group manually. Even this is fine except for the fact that I don’t want to touch each computer the first time it is installed.

So is there a good way to programatically set permissions when the file is created or should I re-think my design because I have missed something about the built in configuration features?

EDIT: Looked in to Application.CommonAppDataPath, but it maintains a folder for each version of the application which means that each new deployment is starting over.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:47:59+00:00Added an answer on May 13, 2026 at 9:47 pm

    Based on this SO post I did this:

    FileSecurity fileSecurity = File.GetAccessControl(file);
    fileSecurity.AddAccessRule(new FileSystemAccessRule("Users",
    FileSystemRights.FullControl,
    AccessControlType.Allow));
    File.SetAccessControl(file, fileSecurity);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to deploy a Windows Forms application using ClickOnce deployment. (VS2008, .NET 3.5)
I am considering using ClickOnce for a legacy Windows Forms application. I have several
I'm deploying an application using ClickOnce, the problem is that the configuration file (xxx.exe.config)
I am installing a WPF Application using the ClickOnce deployment. There are certain settings
I'm creating a Windows app that automatically updates itself. I'm not using ClickOnce for
All, We are using ClickOnce to deploy our WPF application and have the need
I have a console application that I'm deploying using ClickOnce. Once the user installs
We're looking at using ClickOnce deployment as a means of distributing our application. However,
I need a way to specify an application icon for a ClickOnce deployment. Basically
I am using clickonce to distribute my VB.net windows application. It has several prerequisites,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.