tags:

views:

35

answers:

1

I need to get the temp file to see what happened because the actual file is never output. However, I can't seem to find where the temp file is created.

I need to find this out without writing code or building the application because there are too many dependencies scattered all over the place. I would not be able to deploy a debug version.

+2  A: 

That method returns the path of a temporary file. The path will tell you where its pointing.

For example:

Console.WriteLine(Path.GetTempFileName());

produces:

C:\Users\will\AppData\Local\Temp\tmp9BD5.tmp

for me on this machine, because the TEMP environment variable is pointing to C:\Users\will\AppData\Local\Temp\

But the whole point of a method like GetTempFileName is that you shouldn't have to care where the file ends up. On the off-chance that you do, you can always get there at command prompts or file-open dialogs by using %TEMP%

Will Dean
I don't have access to change the code. I do have access to view the code and that's how I found out that it's using this method.
Brian T Hannan
OK, then looking in the %TEMP% directory should help you find it. Of course, a well-managed temporary file might be around for very long...
Will Dean
Thanks, that's it ... in Win7 it's in AppData\Local\Temp\ in my case!
Brian T Hannan