Saltar al contenido
Skillpedia
APIs y servidores (backend)40 mil · #7402

resx-source-generator-migration

Qué hace

Este código sirve para actualizar tus proyectos de software. Sustituye una forma antigua de gestionar los archivos de recursos (textos, mensajes) por otra más moderna y eficiente, usando un 'generador de código fuente'.

Cuándo usarla

  • ✓Cuando quieres modernizar un proyecto antiguo.
  • ✓Cuando quieres optimizar el rendimiento de tu programa.
  • ✓Para simplificar la gestión de los textos.

Link de la skill

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

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/github/awesome-copilot/blob/main/skills/resx-source-generator-migration/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Migra mi proyecto 'MyProject.csproj' para usar el generador de código fuente con los archivos .resx.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

Añade una nueva herramienta a tu proyecto y elimina las configuraciones antiguas que creaban archivos de código adicionales. Así, el código que accede a los textos se genera automáticamente.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de 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

…

Preguntas frecuentes

¿Qué son los archivos .resx?

Son archivos que guardan los textos y mensajes que usa tu programa, como las etiquetas de los botones y los mensajes de error, para facilitar la traducción y la gestión.

¿Qué es un 'generador de código fuente'?

Es una herramienta que escribe código automáticamente a partir de otra información. En este caso, genera el código para acceder a los textos de los archivos .resx.

¿Tengo que preocuparme por los archivos .Designer.cs?

No, el objetivo de esta actualización es precisamente eliminar la necesidad de estos archivos generados automáticamente, para que el proceso sea más limpio.

Detalles

Descripción original del autor

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

repo: github/awesome-copilot

Popularidad

Estrellas en GitHub
40 mil
Posición en el ranking
#7402
Licencia
MIT
Actualizada
15/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas