Question

I was doing some Path.Combine stuff in a c# class and it was working previously. I've now moved my project to a tfs workspace and the codes broken in a couple of classes where I was using the Path.Combine method.

Here is the code that's breaking now :

    string rootPath = Environment.CurrentDirectory;
    string filePath = Path.Combine(rootPath,@"..\..\AdminAccount\User.txt");
    private string[] getLines = System.IO.File.ReadAllLines(@filePath);

The error : The name 'Path' does not exist in the current context.

If someone could help me understand why this is happening so that I can prevent it from happening again.

A quick overview of my file paths so you can see exactly how I'm doing all these paths, although this may not be anything to do with the issue:

enter image description here

Was it helpful?

Solution

string filePath = System.IO.Path.Combine(rootPath,@"..\..\AdminAccount\User.txt");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top