First of all, I know that there are many questions that are similar to this, but I could not get an answer to my problems.
So, in general, I run a program that should get the path to solving another visual studio project solution file, and I only have the name of the file itself.
For example, my program runs in the background and a visual studio project is currently being encoded, I need to get a way to solve this project. The project has not yet been drawn up; it is a new project that has just been created. For example, MyProject.sln is the file and directory I'm looking for, it's C:\Users\MyUser\Documents\Visual Studio 2015\Projects\MyProject\MyProject.sln . Of course, the project can be anywhere on the computer, for example, on another disk or not in the visual studio folder.
I tried using methods like Path.GetDirectoryName(filename) , which returns an empty string, or Path.GetFullPath(path) , which returns the wrong path (the one that searches for the path), or Directory.GetDirectories(path,searchPattern) some with SearchOptions, and then I get authorization errors for SearchOption.AllDirectories for a large number of files.
I really got lost here, hope someone can help!
source share