How to get Directory while running unit test

后端 未结 14 1085
余生分开走
余生分开走 2021-02-02 05:07

Hi when running my unit test I\'m wanting to get the directory my project is running in to retrieve a file.

Say I have a Test project named MyProject. Test I run:

<
14条回答
  •  半阙折子戏
    2021-02-02 05:42

    You can do it like this:

    using System.IO;
    
    Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, @"..\..\"));
    

提交回复
热议问题