응용 프로그램 폴더 경로를 얻는 방법이 몇 가지 있습니다.
Application.StartupPathSystem.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location)AppDomain.CurrentDomain.BaseDirectorySystem.IO.Directory.GetCurrentDirectory()Environment.CurrentDirectorySystem.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)System.IO.Path.GetDirectory(Application.ExecutablePath)
상황에 따라 가장 좋은 방법은 무엇입니까?
IHostEnvironment.ContentRootPath주입 된 IHostEnvironment의존성 (다른 유용한 것들을 포함)을 통해 액세스 할 수있는 신뢰할 수 있습니다 .