사전지식
그냥 내버려두면 debug 폴더 따로, release 폴더 따로 저장된다.
특정 위치에 하나만 두고 글로발 하게 사용하고 싶을 떄 2가지 방법이 있는 거 같다.
실습
1.
var config = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap(){ExeConfigFilename = SomePath + "/App.config"}, ConfigurationUserLevel.None);
2.
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", SomePath + "/App.config");
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
여러 개의 config 파일을 로드하고자 할 때 1번, 하나만 쓸 거면 2번으로 가는 게 적당할 것 같다.
'C# > 예제 코드' 카테고리의 다른 글
c# 자바스크립트 문자열 encode & decode (escape) (0) | 2022.03.08 |
---|---|
c# 특정 폴더 컴파일 제외 .csproj 수정 (0) | 2022.03.08 |
c# 빌드할때 폴더 복사 .csproj 수정 (0) | 2022.03.08 |
c# 프로젝트 폴더 경로 구하기. (0) | 2022.03.08 |
c# config 값 저장하기 (process.env?) (0) | 2022.02.09 |