resx-source-generator-migration
Что он делает
Этот код помогает обновлять ваши программные проекты. Он заменяет старый способ работы с файлами ресурсов (текстов, сообщений) на более современный и эффективный, с использованием «генератора исходного кода».
Когда использовать
- ✓Когда вы хотите модернизировать старый проект.
- ✓Когда нужно повысить производительность программы.
- ✓Чтобы упростить управление текстами.
Ссылка на скилл
https://github.com/github/awesome-copilot/blob/main/skills/resx-source-generator-migration/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Перенеси мой проект '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:
- If the repository centrally manages package versions and already has a
PackageVersionforMicrosoft.CodeAnalysis.ResxSourceGenerator, add this versionless reference to anItemGroupin the project file:
<PackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" PrivateAssets="all" />
- 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
PackageReferenceor add the corresponding centralPackageVersion. - 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:
LastGenOutputmetadata on theEmbeddedResourceitem;- a
Compileitem whoseDependentUponmetadata names the .resx file; and - a matching
*.Designer.csfile on disk, even when the SDK includes it implicitly and noCompileitem 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:
- Delete the
*.Designer.csfile from disk. - Remove its explicit MSBuild item from the project when one exists.
Update EmbeddedResource items
…
Частые вопросы
Что такое файлы .resx?
Это файлы, в которых хранятся тексты и сообщения программы, например подписи кнопок и сообщения об ошибках. Так их проще переводить и поддерживать.
Что такое «генератор исходного кода»?
Это инструмент, который автоматически пишет код на основе другой информации. В данном случае он создаёт код для доступа к текстам из файлов .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
- Обновлён
- 15.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
acquire-codebase-knowledge
40kПомогает агенту понять и задокументировать существующий проект.
acreadiness-assess
40kАгент оценивает готовность проекта к работе с ИИ и составляет отчёт.
acreadiness-generate-instructions
40kПомогает агенту создать инструкции для ИИ-инструментов по итогам оценки.
acreadiness-policy
40kАгент помогает задавать политики оценки ИИ-готовности проектов.
Похожие скиллы
api-connector-builder
280kАгент создаёт новые подключения к API по существующему шаблону. Используйте, когда нужна ещё одна интеграция без нового способа делать то же самое.
api-design
280kПомогает агенту проектировать REST API по лучшим практикам: как API общаются, как показываются ошибки и как организовать данные.
backend-patterns
280kПомогает агенту с архитектурными паттернами серверной части и оптимизацией баз данных. Полезен при создании и проверке серверного кода.