Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 5개 있습니다.)
(시리즈 글이 4개 있습니다.)
.NET Framework: 975. .NET Core를 직접 호스팅해 (runtimeconfig.json 없이) EXE만 배포해 실행
; https://www.sysnet.pe.kr/2/0/12427

.NET Framework: 992. C# - .NET Core 3.0 이상부터 제공하는 runtimeOptions의 rollForward 옵션
; https://www.sysnet.pe.kr/2/0/12471

.NET Framework: 1165. .NET Core/5+ 빌드 시 runtimeconfig.json에 설정을 반영하는 방법
; https://www.sysnet.pe.kr/2/0/12983

.NET Framework: 2096. .NET Core/5+ - PublishSingleFile 유형에 대한 runtimeconfig.json 설정
; https://www.sysnet.pe.kr/2/0/13265




.NET Core/5+ 빌드 시 runtimeconfig.json에 설정을 반영하는 방법

예전에 아래의 옵션을 소개해 드렸는데요,

C# - .NET Core 3.0 이상부터 제공하는 runtimeOptions의 rollForward 옵션
; https://www.sysnet.pe.kr/2/0/12471

아마도 이 옵션을 설정하기 위해, 빌드한 결과물에서 직접 runtimeconfig.json 파일을 열어 편집하지는 않을 것입니다. 현실적으로는, 빌드 과정 중에 처리되도록 csproj에 다음과 같은 노드를 추가하는 식일 텐데요,

<!-- https://learn.microsoft.com/en-us/dotnet/core/versions/selection#control-roll-forward-behavior -->

<PropertyGroup>
  <RollForward>Major</RollForward>
</PropertyGroup>

이 외에도 기존 닷넷 프레임워크의 app.settings처럼 프로젝트에 runtimeconfig.template.json 이름의 파일을 추가해 설정하는 것도 가능합니다.

Example runtimeconfig.template.json file
; https://learn.microsoft.com/en-us/dotnet/core/runtime-config/#example-runtimeconfigtemplatejson-file

문제는 이 파일의 형식이 runtimeconfig.json과 일치하지 않는다는 점입니다. 그래서 (저처럼 ^^;) 무심코 다음과 같이 설정하면,

{
  "runtimeOptions": {
    "tfm": "netcoreapp3.0",
    "rollForward": "Major",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "3.0.0"
    }
  }
}

빌드 후 생성되는 runtimeconfig.json 파일에는 이렇게 내용이 포함됩니다.

{
  "runtimeOptions": {
    "tfm": "netcoreapp3.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "3.0.0"
    },
    "rollForward": "Major"
  },
  "runtimeOptions": {
    "tfm": "netcoreapp3.0",
    "rollForward": "Major",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "3.0.0"
    }
  }
}

전혀 원치 않는 결과죠? 게다가 저런 경우 첫 번째 발견한 runtimeOptions의 설정을 사용합니다. "Example runtimeconfig.template.json file" 문서를 잘 읽어보시면 이것의 원인을 찾을 수 있습니다.

If you're placing the options in the template JSON file, omit the runtimeOptions property.

그렇습니다. ^^; "runtimeOptions" 내부의 설정에서 필요한 것만 포함하면 되는 것입니다.

{
    "rollForward": "Major"
}




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 2/18/2023]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 151  152  [153]  154  155  156  157  158  159  160  161  162  163  164  165  ...
NoWriterDateCnt.TitleFile(s)
1288정성태5/17/201229146.NET Framework: 321. regasm.exe로 어셈블리 등록 시 시스템 변경 사항 (3) - Type Library파일 다운로드1
1287정성태5/17/201231831.NET Framework: 320. regasm.exe로 어셈블리 등록 시 시스템 변경 사항 (2) - .NET 4.0 + .NET 2.0 [2]
1286정성태5/17/201240552.NET Framework: 319. regasm.exe로 어셈블리 등록 시 시스템 변경 사항 (1) - .NET 2.0 + x86/x64/AnyCPU [5]
1285정성태5/16/201235920.NET Framework: 318. gacutil.exe로 어셈블리 등록 시 시스템 변경 사항파일 다운로드1
1284정성태5/15/201228339오류 유형: 155. Windows Phone 연결 상태에서 DRIVER POWER STATE FAILURE 블루 스크린 뜨는 현상
1283정성태5/12/201236010.NET Framework: 317. C# 관점에서의 Observer 패턴 구현 [1]파일 다운로드1
1282정성태5/12/201228740Phone: 6. Windows Phone 7 Silverlight에서 Google Map 사용하는 방법 [3]파일 다운로드1
1281정성태5/9/201235685.NET Framework: 316. WPF/Silverlight의 그래픽 단위와 Anti-aliasing 처리를 이해하자 [1]파일 다운로드1
1280정성태5/9/201229059오류 유형: 154. Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, ...'.
1279정성태5/9/201227662.NET Framework: 315. 해당 DLL이 Managed인지 / Unmanaged인지 확인하는 방법 [1]파일 다운로드1
1278정성태5/8/201229246오류 유형: 153. Visual Studio 디버깅 - Unable to break execution. This process is not currently executing the type of code that you selected to debug.
1277정성태5/8/201233906오류 유형: 152. cmd.exe - The system cannot write to the specified device. [2]
1276정성태4/28/201226089Phone: 5. 모든 Marketplace에 윈폰 앱을 등록하는 방법 [1]
1275정성태4/28/201229488개발 환경 구성: 150. 프로세스 실행으로 잠긴 파일이지만, 이름은 변경가능하다는 사실! 아셨나요? [7]
1274정성태4/17/201224132Phone: 4. "Holiday Calendar" 윈폰 응용 프로그램 등록
1273정성태4/6/201228002Phone: 3. 윈도우 폰을 위한 Holiyday Calendar 앱 개발파일 다운로드1
1272정성태4/5/201228530오류 유형: 151. ASP.NET - EcbGetUnicodeServerVariables 코드에서 System.AccessViolationException 예외 발생
1271정성태4/3/201230795Math: 6. 동전을 여러 더미로 나누는 경우의 수 세기 [1]
1270정성태3/29/201225886오류 유형: 150. Visual Studio 2010 원격 디버깅 오류 - Kerberos authentication failed
1269정성태3/27/201239824오류 유형: 149. ODP.NET 오류 - The provider is not compatible with the version of Oracle client
1268정성태3/27/201235941오류 유형: 148. WCF svc 호출 시 HTTP Error 404.17 - Not Found [1]
1267정성태3/16/201234403.NET Framework: 314. C++의 inline asm 사용을 .NET으로 포팅하는 방법 [1]파일 다운로드1
1266정성태3/14/201237119개발 환경 구성: 149. RAID 1 구성 시 하드 디스크 장애 발생 해결에 대한 경험담
1265정성태3/13/201227393VC++: 61. 아이태니엄(IA64: Itanium) 에서 겪은 C++ 포인터 연산 문제 [2]
1264정성태3/10/201247413.NET Framework: 313. WELL512 난수 발생 알고리즘 - C# [5]파일 다운로드1
1263정성태3/9/201225609개발 환경 구성: 148. tinyget 사용법
... 151  152  [153]  154  155  156  157  158  159  160  161  162  163  164  165  ...