Skip to content

Dotnet buildaction uses given build action verbatim if no matching mapping is found rather than using the None fallback#2729

Open
CapeGuyBen wants to merge 1 commit into
premake:masterfrom
CapeGuyGames:feature/dotnet_build_action_fallback
Open

Dotnet buildaction uses given build action verbatim if no matching mapping is found rather than using the None fallback#2729
CapeGuyBen wants to merge 1 commit into
premake:masterfrom
CapeGuyGames:feature/dotnet_build_action_fallback

Conversation

@CapeGuyBen

@CapeGuyBen CapeGuyBen commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Allows user-specific build actions to be specified by using the given build action verbatim if no mapping is found rather than falling back to "None".

How does this PR change Premake's behavior?

If a build action is provided that doesn't match one of the pre-defined actions then it will be applied to the associated files as specified instead of being ignored.

For example, MonoGame projects use the custom "MonoGameContentReference" buildaction. With this change it's possible to specify that when using a premake project.

  • Focus on a single fix or feature; remove any unrelated formatting or code changes
  • Add unit tests showing fix or feature works; all tests pass
  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • Follow our coding conventions
  • Minimize the number of commits
  • Align documentation to your changes

@CapeGuyBen

CapeGuyBen commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Improves #614. Though there's a possibility of a name clash between premake's predefined actions and the user's custom name with this approach.

This allows custom build actions (defined via project dependencies) to be run but does not allow the user to specify new ones.

@Jarod42 Jarod42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would i make sense to extend it to C/C++ actions too?

Comment thread src/tools/dotnet.lua Outdated
end
else
info.action = "None"
if (fcfg.buildaction == nul) then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (fcfg.buildaction == nul) then
if fcfg.buildaction == nil then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, applied.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this makes sense for C++ projects in general. Is the concept applicable to all the generators? It's probably a bit beyond the scope of this PR.

…pping is found rather than using the None fallback
@CapeGuyBen CapeGuyBen force-pushed the feature/dotnet_build_action_fallback branch from ad3be42 to 6460202 Compare July 8, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants