none
Deploying win forms project RRS feed

  • Question

  • Hi,

    I want  to deploy project on LAN. So that it can be installed from there.

    The problem is i want to create specific folder structure after installation and put some file also inside the folder

    for Eg:

    c:\program files\ProjectsD

    inside projectD i want to create two more folders automatically say

    DirA

    Dir B

    This can be achieved with setup project But how i can do this while Deploying or publishing win forms app

    Monday, July 23, 2012 12:24 PM

Answers

  • Hi chandanshukla,

    Starting with Windows Vista, Microsoft strongly recommends that you not place data files or write user data to Program Files, and they require elevated permissions to do so every time.

    You should place application data files in Local Application Data. I'm assuming your application is doing this when it runs.

        string userFilePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);   

        string myFolder = Path.Combine(userFilePath, "MyCompany");

        if (!Directory.Exists(myFolder))

            Directory.CreateDirectory(myFolder);

    You can create your folders programmatically and put anything in them that you want to.

    This will work with both a ClickOnce application (the publish tab in VS, which allows you to host your deployment on a network share) or a setup & deployment project.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev

    Tuesday, July 24, 2012 6:00 AM
    Moderator

All replies

  • Hi chandanshukla,

    As far as I know, ClickOnce is designed for per user and does not require Administration priviledges. If you have to create such folders, I'm afraid you have to use setup project. There is a thread about this:

    http://social.msdn.microsoft.com/forums/en-us/winformssetup/thread/97ED53F9-A617-4E25-A92A-6E35A9D523AF

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 24, 2012 5:23 AM
    Moderator
  • Hi chandanshukla,

    Starting with Windows Vista, Microsoft strongly recommends that you not place data files or write user data to Program Files, and they require elevated permissions to do so every time.

    You should place application data files in Local Application Data. I'm assuming your application is doing this when it runs.

        string userFilePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);   

        string myFolder = Path.Combine(userFilePath, "MyCompany");

        if (!Directory.Exists(myFolder))

            Directory.CreateDirectory(myFolder);

    You can create your folders programmatically and put anything in them that you want to.

    This will work with both a ClickOnce application (the publish tab in VS, which allows you to host your deployment on a network share) or a setup & deployment project.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev

    Tuesday, July 24, 2012 6:00 AM
    Moderator