Skip to content

buildaction

Jason Perkins edited this page Apr 14, 2015 · 11 revisions

The buildaction function specifies how a file or set of files should be treated during the compilation process. It is usually paired with a filter to select a file set. If no build action is specified for a file a default action will be used, based on the file's extension.

#!lua
buildaction ("action")

Build actions are currently only supported for C# projects, and will be ignored for other project types.

Parameters

action is one of

Action Description
Application Mark the file as the application definition XAML for WPF.
Compile Treat the file as source code; compile and link it.
Component Treat the source file as a component, usually a visual control.
Copy Copy the file to the target directory.
Embed Embed the file into the target binary as a resource.
Form Treat the source file as visual (Windows) form.
None Do nothing with this file.
Resource Copy/embed the file with the project resources.
UserControl Treat the source file as visual user control.

The descriptive actions such as Component, *Form, and UserControl are only recognized by Visual Studio, and may be considered optional as Visual Studio will automatically deduce the types when it first examines the project. You only need to specify these actions to avoid unnecessary modifications to the project files on save.

Applies To

Individual file configurations.

Availability

Compile, Copy, Embed, and None are available in Premake 4.x. All actions are available in Premake 5.0 or later.

Examples

Embed all PNG images files into the target binary.

#!lua
filter 'files:**.png'
   buildaction "Embed"
Clone this wiki locally