Raghu Raghu - 1 month ago 5
C# Question

'System.IO.FileNotFoundException' is found. But path is correct. Working in other Applications

enter image description here

Provided path is correct. It is working in other solution. But here, it is searching the mentioned file in bin/debug folder. but its in root directory. Please provide the cause and solution. ASAP. Thanks in Advance.

Answer

If you click on your "TestFile1.txt" file in your Solution Explorer and go to its properties, you will see something similar to this:

enter image description here

Change the "Copy to Output Directory" from Do Not Copy to Always Copy. What this will do is always make sure your 'TestFile1.txt' is copied to your Bin folder.

Comments