Adding embedded resources to a Visual Studio project

Open
#1,667 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
lua
Domain
build-system

Research direction

Start with the premake script using the files, filter, and buildaction settings for the VS2019 solution. Compare the generated project with the manually added image that produces .rc and resource.h files. Done means the generated project embeds the image so it can be retrieved from the executable at runtime.

Written by the indexing model from the issue text.

Description

support-request

What are you trying to do?
Add an embedded resource to a VS2019 solution by using a premake script, so it can then be retrieved at runtime from the executable.

What have you tried so far?

files { "files:%{prj.location}/resource/splashscreen.png" }
filter "files:%{prj.location}/resource/splashscreen.png"
    buildaction "Embed"       -- Also tried "Resource"
filter {}

This adds the .png file to the solution explorer as a resource and seems to somehow build it, but no .rc and resource.h files are generated. When switching to 'Resource View' in VS and manually adding the image as a resource, it is taken and .rc and resource.h files are generated and everything works. How can this be achieved using premake?

What version of Premake are you using?
premake5 (Premake Build Script Generator) 5.0.0-alpha16

Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from premake/premake-core

All issues in premake/premake-core

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.