We have an extended property to get the path of the config file. User can enter either the absolute path of the config file or a relative path. Relative path can be just the file name indicating in the current project or a path like “..\SecondProject\myConfig.xml” indicating the file from another project in the same solution. For finding the absolute path and reading the config file, we used the EnvDTE along with methodws from Path class.
For accessing the current directory, we used the method specified in https://ambilykk.wordpress.com/2011/03/14/envdte-current-directory/
Now, convert the relative path input to absolute using
Path.GetFullPath(System.IO.Path.Combine(GetCurrentDirectoryPath(), myConfigPath))
This will work with any type of relative path like
This will work with the relative paths like
1. Path.GetFullPath(System.IO.Path.Combine(GetCurrentDirectoryPath(), “MyFile.xml”))
2. Path.GetFullPath(System.IO.Path.Combine(GetCurrentDirectoryPath(), “..\SecondProject\MyFile.xml”))