본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)40k · #7402

resx-source-generator-migration

하는 일

이 코드는 소프트웨어 프로젝트를 업데이트하는 데 도움을 줍니다. 텍스트와 메시지 같은 리소스 파일을 다루는 오래된 방식을 'source code generator'를 사용하는 더 현대적이고 효율적인 방식으로 바꿉니다.

사용하는 경우

  • ✓오래된 프로젝트를 최신 방식으로 바꾸고 싶을 때.
  • ✓프로그램의 성능을 높이고 싶을 때.
  • ✓텍스트를 관리하는 방식을 단순하게 만들고 싶을 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/resx-source-generator-migration/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/resx-source-generator-migration/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 프로젝트 'MyProject.csproj'가 .resx 파일에 대해 소스 생성기를 사용하도록 옮겨 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

프로젝트에 새 도구를 추가하고, 추가 코드 파일을 만들던 오래된 설정을 제거합니다. 그러면 텍스트에 접근하는 코드가 자동으로 생성됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Your goal is to migrate the project to use a source-generator for .resx files instead of checked-in .designer.cs files.

User Input

Amend the instructions below with the following user input. The user input is likely to be an absolute or repo-relative path to an msbuild project file or a directory containing an msbuild project to be migrated.

$ARGUMENTS

Migration

Complete each of the following sub-sections.

Opt into the source generator

Inspect the target's package-management setup and configured NuGet sources before adding the package:

  1. If the repository centrally manages package versions and already has a PackageVersion for Microsoft.CodeAnalysis.ResxSourceGenerator, add this versionless reference to an ItemGroup in the project file:
<PackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" PrivateAssets="all" />
  1. If no central version exists, select a package version compatible with the target SDK/compiler and follow the repository's established version-management pattern. Specify the version on the PackageReference or add the corresponding central PackageVersion.
  2. Verify that the configured NuGet sources can resolve the selected package. If they cannot, ask the user before changing feed configuration.

Remove traces of .resx code-behind files

Search for any msbuild items related to resx files. They typically come in pairs, as shown below:

<ItemGroup>
  <Compile Update="Strings.Designer.cs">
    <DesignTime>True</DesignTime>
    <AutoGen>True</AutoGen>
    <DependentUpon>Strings.resx</DependentUpon>
  </Compile>
</ItemGroup>

<ItemGroup>
  <EmbeddedResource Update="Strings.resx">
    <Generator>ResXFileCodeGenerator</Generator>
    <LastGenOutput>Strings.Designer.cs</LastGenOutput>
  </EmbeddedResource>
</ItemGroup>

Note that you might also find <Generator>PublicResXFileCodeGenerator</Generator> (or <CustomTool> instead of <Generator>) as .resx item metadata.

For each strongly typed .resx file being migrated, identify its generated designer file using all of these signals:

  • LastGenOutput metadata on the EmbeddedResource item;
  • a Compile item whose DependentUpon metadata names the .resx file; and
  • a matching *.Designer.cs file on disk, even when the SDK includes it implicitly and no Compile item exists.

Before deleting a candidate, inspect its contents and confirm it is a generated resource accessor, such as a class containing ResourceManager, Culture, and properties that retrieve resource values. A matching filename alone is not sufficient. Do not delete WinForms or control designer files that contain UI initialization such as InitializeComponent; these commonly sit beside a same-named .resx file, and their DependentUpon metadata points to the form or control source file rather than the .resx file.

Also confirm that every resource exposed by the designer is a string and that the .resx file contains no images, icons, byte arrays, serialized objects, or other non-string values. This source generator emits string accessors backed by ResourceManager.GetString; it is not a compatible replacement for non-string resource properties. If any non-string resource exists, do not delete the designer or migrate that resource file. Keep its existing generation approach, or set <GenerateSource>false</GenerateSource> if the package would otherwise process it.

Before deletion, search the solution for every use and declaration of the accessor type. ResXFileCodeGenerator emits a non-static class, while this source generator emits a static partial class. Identify object construction, instance access, inheritance, use as a generic type argument (including IStringLocalizer<T>), and existing partial declarations with instance members, base types, or interfaces. Refactor each incompatible use to the static generated API and make every partial declaration compatible before migrating. If that is not appropriate, retain the existing designer and set <GenerateSource>false</GenerateSource> for that resource file.

For each associated designer file:

  1. Delete the *.Designer.cs file from disk.
  2. Remove its explicit MSBuild item from the project when one exists.

Update EmbeddedResource items

…

자주 묻는 질문

.resx 파일이란 무엇인가요?

프로그램에서 사용하는 텍스트와 메시지, 예를 들어 버튼 이름이나 오류 메시지를 저장하는 파일입니다. 번역과 관리를 쉽게 해 줍니다.

'source code generator'란 무엇인가요?

다른 정보를 바탕으로 코드를 자동으로 써 주는 도구입니다. 이 경우에는 .resx 파일의 텍스트에 접근하는 코드를 생성합니다.

.Designer.cs 파일을 신경 써야 하나요?

아니요. 이번 업데이트의 목적은 자동으로 생성되던 .Designer.cs 파일을 없애 과정을 더 깔끔하게 만드는 것입니다.

상세 정보

작성자의 원본 설명

Migrates a project that uses checked-in .designer.cs files behind .resx to using a source-generator instead

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7402
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬