1

I'm creating a web job on Azure that is going to be a c# console application (.exe). Inside this program I need to read a text file from the file system. Is there a way to include the text file I need in the executable? Where do I put the file and how do I reference it?

I also don't want anyone (via the website) be able to access the file.

erotavlas
  • 4,274
  • 4
  • 45
  • 104

2 Answers2

5

Just deploy the text file alongside the executable, and you'll be able to open it in the current folder.

If deploying the WebJob from Visual Studio, make sure to mark the text file's properties as 'Copy if newer' to make sure it gets deployed.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • 1
    From the REST API I found this "path":"D:\\home\\site"....there are also several other folders under the path D:\\ in the json file. I'm just not sure which one to use. Someone suggested it was better to use WEBROOT_PATH instead but I don't know the syntax to reference that path. http://stackoverflow.com/a/24190546/1462656 – erotavlas Mar 10 '16 at 04:28
  • 1
    If you deploy it next to the WebJob, just use the current folder to reference it. You do not need to hard code any specific directory. – David Ebbo Mar 10 '16 at 16:30
0

Follow instead of putting a file location in the value as parameter just put this as I show you here

  1. Put it in Appconfig file for path as
  2. to copy this text file into your bin/debug folder to
  3. Make zip folder as usual, put that test file int "debug.zip"
madhu b
  • 1
  • 1