Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the various "Build action" settings in Visual Studio project properties and what do they do?

For the most part, you just take whatever Visual Studio sets it for you as a default... I'm referring to the BuildAction property for each file selected in Solution Explorer. There are a number of options and it's difficult to know what each one of them will do.

like image 927
Gishu Avatar asked Sep 28 '08 12:09

Gishu


People also ask

What is Build action in Visual Studio?

All files in a Visual Studio project have a build action. The build action controls what happens to the file when the project is compiled. This topic applies to Visual Studio on Windows. For Visual Studio for Mac, see Build actions in Visual Studio for Mac.

Where is project Settings Visual Studio?

In Visual Studio, you can access project settings by right-clciking the projects node in Solution Explorer, and choosing "Properties" from the context menu (not to be confused with the "Properties" folder that is in some Elements projects).

Where is Build file in Visual Studio?

On the menu bar, choose Tools > Options. On the Projects and Solutions page, choose the Build and Run page.

How do I see Properties in Visual Studio?

You can find Properties Window on the View menu. You can also open it by pressing F4 or by typing Properties in the search box. The Properties window displays different types of editing fields, depending on the needs of a particular property.


1 Answers

  • None: The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file.

  • Compile: The file is compiled into the build output. This setting is used for code files.

  • Content: Allows you to retrieve a file (in the same directory as the assembly) as a stream via Application.GetContentStream(URI). For this method to work, it needs a AssemblyAssociatedContentFile custom attribute which Visual Studio graciously adds when you mark a file as "Content"

  • Embedded resource: Embeds the file in an exclusive assembly manifest resource.

  • Resource (WPF only): Embeds the file in a shared (by all files in the assembly with similar setting) assembly manifest resource named AppName.g.resources.

  • Page (WPF only): Used to compile a xaml file into baml. The baml is then embedded with the same technique as Resource (i.e. available as `AppName.g.resources)

  • ApplicationDefinition (WPF only): Mark the XAML/class file that defines your application. You specify the code-behind with the x:Class="Namespace.ClassName" and set the startup form/page with StartupUri="Window1.xaml"

  • SplashScreen (WPF only): An image that is marked as SplashScreen is shown automatically when an WPF application loads, and then fades

  • DesignData: Compiles XAML viewmodels so that usercontrols can be previewed with sample data in Visual Studio (uses mock types)

  • DesignDataWithDesignTimeCreatableTypes: Compiles XAML viewmodels so that usercontrols can be previewed with sample data in Visual Studio (uses actual types)

  • EntityDeploy: (Entity Framework): used to deploy the Entity Framework artifacts

  • CodeAnalysisDictionary: An XML file containing custom word dictionary for spelling rules

like image 148
Gishu Avatar answered Oct 09 '22 18:10

Gishu