locked
Application Data Folder Problems in Visual Studio 2015 Setup RRS feed

  • Question

  • I'm having issues with where my settings file is being installed vs. where the application wants to read it from.

    Originally, I used

    [CommonAppDataFolder][Manufacturer]\[ProductName]

    in the installer destination, and in the application itself, I read it like this

    settingsPath = Path.GetDirectoryName(Application.CommonAppDataPath);

    So now it's sitting in this folder:

    C:\ProgramData\MANUFACTURER\PRODUCT\

    And the application finds its settings file.  But, I thought it was better to use the version as part of the data path, so if my settings changed from version to version it would keep track of them.  Unfortunately, the installer project only keeps 3 segments of the version, so specifying

    [CommonAppDataFolder][Manufacturer]\[ProductName]\[ProductVersion]

    results in the settings file being installed to 

    C:\ProgramData\MANUFACTURER\PRODUCT\1.0.2

    whereas in the application, using

    settingsPath = Application.CommonAppDataPath;

    results in trying to find the file in 

    C:\ProgramData\MANUFACTURER\PRODUCT\1.0.2.0

    Which of course it's not in.  I can try

    settingsPath = Application.CommonAppDataPath.Remove(Application.CommonAppDataPath.LastIndexOf("."));
    which works, but I'm not sure if that is the proper way.  Is there a better method?  Thanks...

    Ron Mittelman


    • Edited by RMittelman Monday, December 18, 2017 10:13 PM
    • Moved by 宝宝徐 Tuesday, December 19, 2017 2:16 AM
    Monday, December 18, 2017 10:11 PM

Answers

All replies

  • Hi RMittelman,

    Thank you for posting in MSDN forum.

    This forum is discussing about VS setup and installation, as your question is much related to read application settings file , I help you direct this case to a much appropriate forum to get a professional support.

    Thank you for your understanding.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 19, 2017 2:16 AM
  • Not sure why they kicked it but might also try over here.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=windowsforms

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    Tuesday, December 19, 2017 1:42 PM
  • So which forum are you going to direct me to?  Please advise...

    Also, I disagree that the question is only related to settings file.  Any application data files or databases would have the same issue.  My question is more related to how the application sees the special folder names compared to how the setup project sees them.

    Unless I see something different, I guess i can stick with my work-around mentioned in my last exampel code.


    Ron Mittelman

    Tuesday, December 19, 2017 4:36 PM