本文介绍了什么是各种“构建动作"?Visual Studio 项目属性中的设置以及它们的作用是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大多数情况下,您只需将 Visual Studio 为您设置的任何内容作为默认值...我指的是 BuildAction 属性.有多种选择,很难知道每个选择会做什么.

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.

推荐答案

  • :该文件不包含在项目输出组中,也不会在构建过程中编译.一个示例是包含文档的文本文件,例如自述文件.

    • 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:允许您通过 Application.GetContentStream(URI) 以流的形式检索文件(在与程序集相同的目录中).要使此方法起作用,它需要一个 AssemblyAssociatedContentFile 自定义属性,当您将文件标记为内容"时,Visual Studio 会慷慨地添加该属性

      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):将文件嵌入名为 AppName.g 的共享(程序集中的所有文件具有类似设置)程序集清单资源中.资源.

      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):用于将 xaml 文件编译为 baml.然后将 baml 嵌入与 Resource 相同的技术(即可用作`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):标记定义您的应用程序的 XAML/类文件.您使用 x:Class="Namespace.ClassName" 指定代码隐藏并使用 StartupUri="Window1.xaml"

      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):标记为 SplashScreen 的图像 在 WPF 应用程序加载时自动显示,然后消失

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

      DesignData:编译 XAML 视图模型,以便可以在 Visual Studio 中使用示例数据预览用户控件(使用模拟类型)

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

      DesignDataWithDesignTimeCreatableTypes:编译 XAML 视图模型,以便可以在 Visual Studio 中使用示例数据预览用户控件 (使用实际类型)

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

      EntityDeploy:(实体框架):用于部署实体框架构件

      CodeAnalysisDictionary:包含 自定义词典 拼写规则

      这篇关于什么是各种“构建动作"?Visual Studio 项目属性中的设置以及它们的作用是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 11:53