“Build action” settings in VS.NET project properties and what do they do?

The BuildAction property indicates what Visual Studio does with a file when a build is executed. BuildAction can have one of several values:

  • 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 - The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .htm or other kind of Web file.
  • Embedded Resource - This file is embedded in the main project build output as a DLL or executable. It is typically used for resource files. That means it will embeds the file in an exclusive assembly manifest resource.
  • "Resource" : embeds the file in a shared (by all files in the assembly with similar setting) assembly manifest resource named AppName.g.resources.
  • Page -- Takes the specified XAML file, and compiles into BAML, and embeds that output into the managed resource stream for your assembly (specifically AssemblyName.g.resources), Additionally, if you have the appropriate attributes on the root XAML element in the file, it will create a blah.g.cs file, which will contain a partial class of the "codebehind" for that page; this basically involves a call to the BAML goop to re-hydrate the file into memory, and to set any of the member variables of your class to the now-created items (e.g. if you put x:Name="foo" on an item, you'll be able to do this.foo.Background = Purple; or similar.
  • ApplicationDefinition -- similar to Page, except it goes onestep furthur, and defines the entry point for your application that will instantiate your app object, call run on it, which will then instantiate the type set by the StartupUri property, and will give your mainwindow.

posted on 2010-05-16 08:39  黑头  阅读(493)  评论(0编辑  收藏  举报

导航