Compartilhar via


Recursos Vinculados versus Incorporados

Projetos de Visual Studio fornecem duas opções para a manipulação de recursos: eles podem ser vinculados (o padrão) ou incorporados. You can have both linked and embedded resources in a single project. However, most of the time you will want to choose one option for all resources in your project.

Linked resources are stored as files in the project; during compilation the resource data is taken from the files and added to the manifest for the application. The application's resource file (.resx) stores only a relative path or link to the file on disk.

With embedded resources, the resource data is stored directly in the .resx file in a text representation of the binary data. In either case, the resource data is compiled into the executable file.

You can change resources from linked to embedded by changing the Persistence property for the resource file. For more information, see Como: Criar recursos incorporados.

ObservaçãoObservação

String resources are always embedded and cannot be changed; file resources are always linked and cannot be changed.

Choosing Between Embedded and Linked Resources

In general, you should use linked resources because they are easier to use. However, there are cases in which embedded resources might be a better choice.

Embedded Resources

Embedded resources are the best choice if you have to share application resource (.resx) files between multiple projects. For example, if you have a common resource file that contains your company's logos, trademark information, and such, using embedded resources means you have to copy only the .resx file and not the associated resource data files.

You cannot edit embedded resources directly. If you try to edit an embedded resource, you will receive a message prompting you to convert the item to a linked resource in order to edit it. Conversion is recommended but optional. You must export them, make your modifications in an external program, and then import them back into your project.

For more information about using embedded resources, see Como: Importar ou exportar recursos and Como: Criar recursos incorporados.

Linked Resources

Linked resources (the default) are the best choice for ease of use. Resources can be edited directly inside the project, and you can easily add or remove resources as needed.

Consulte também

Tarefas

Como: Adicionar ou remover recursos

Como: Editar recursos

Como: Criar recursos incorporados

Como: Importar ou exportar recursos

Referência

Página de recursos, Designer de projeto

Outros recursos

Gerenciando Recursos de Aplicativo