Pre-creating directory structure as per entries in .config XML file

Hi,

I have developed a standalone tool using C# and .NET and built the .EXE of the tool.

I also have the correspondig .exe.config file of the tool which looks like this:

< xml version="1.0" encoding="utf-8" >

<configuration>

<appSettings>

<add key = "rules" value = "C:\\DataScrubber\\Rules\\rules.xml"/>

<add key = "lmpafile" value = "C:\\DataScrubber\\Data\\LMPA\\lmpa_data.txt"/>

<add key = "lmpareport" value = "C:\\DataScrubber\\Reports\\LMPA\\lmpa_validation_report.txt"/>

</appSettings>

</configuration>

My questions are:

1) How can I build a script that will pre-create the directories under C:\. as per the directory structure given above

2) Would I be able to include this script as part of the .EXE file, so that when the user runs it on his m/c the subdirectories would get created automatically without the user going into Windows Explorer and creating them manually

3) Would I be able to do 1 and 2 from within Visual Studio.NET environment

Thanks





Answer this question

Pre-creating directory structure as per entries in .config XML file

  • markios

    Create a Setup And Deployment Project if you want the directories to be created on install time. It will create a setup program that copies executables, and creates any directories/files necessary.

  • Geokri

    just create your desired files and folders as you mentioned above in your deployment project. these would be automatically create at the time of installation. whatever hierarchy you would define would be created. it's so simple.

    Thanks



  • mobigital

    Yes, I would like to do an MSI install and during the install, i would like to have the subdirectories created. I also would like to have the rules.xml file be deposited in the Rules subdirectory during the MSI install. Can that be done using SetUp and Deployment Projects

    Thanks



  • Pre-creating directory structure as per entries in .config XML file