C# deployment creating a porject folder
-
For the installation of a C# desktop 2010 application, I am using the traditional setup and deployment template. As part of this template, I want to make certain that a folder is created in a directory path that looks like C:\log_files. Thus can you tell me how to have the setup and deployment project create the directory path for me, if the directory path does not exist?
-
For the installation of a C# desktop 2010 application, I am using the traditional setup and deployment template. As part of this template, I want to make certain that a folder is created in a directory path that looks like C:\log_files. Thus can you tell me how to have the setup and deployment project create the directory path for me, if the directory path does not exist?
I'm not sure about VS2010 as I am still using VS2008, however in the setup project, open the primary output file and click on the 'File System on Target Machine'. There you can add a 'Custom Folder' through the right-click menu. Name the new folder whatever you want, and then click on properties for the new folder and set the default location to the directory path you want to use. Having said that, if this is a folder that your application is going to use during runtime, I would highly recommend that your application check for the existence of the folder and create it if needed before writing the "log files" to it (see the System.IO.Directory class). For instance, will your application crash if after it is installed the user then deletes the "log files" folder? Also, keep in mind that not all users may have permissions to create folders on the C:\ drive. I've run into that issue with Windows7 several times and the permissions we use. You may need to come up with a work-around or use a user's folder instead.
-NP Never underestimate the creativity of the end-user.