Better way to get the base directory?

前端 未结 9 1834
旧巷少年郎
旧巷少年郎 2020-12-25 13:59

I have this code to load a config file and read all the values and it works fine when running the application but of course fails on team city because the appdomain\'s base

9条回答
  •  抹茶落季
    2020-12-25 14:17

    Your question is a bit unclear. I don't really know if this is what you want.

    I typically use AppDomain.CurrentDomain.BaseDirectory

    Alternatives

    • Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
    • Environment.CurrentDirectory

提交回复
热议问题