When debugging the line
Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
Aplication.Executable will return my programs .EXE file path in the Bin\Debug.
however during Unit testing, it will return Visual Studios .EXE file path rather than my programs. Is there any way around this? I've searched and I've noticed people mentioned to try using something like
var execPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
and then passing that like
Configuration config = ConfigurationManager.OpenExeConfiguration(execPath);
however, execPath seems to return just the folder, and not the programs EXE itself.
thanks
Aucun commentaire:
Enregistrer un commentaire