Here are one explaination on the Embedded Resource and the Resource. In this page :
in "what is the difference between a Resource and an Embedded Resource in C# application"
“Resource” and “Content” build actions are to access the WPF resources using the Uris. However “Embedded Resource” is for prior technologies. However both options embeds the resource in assembly but “Resource” option to be used for WPF.
And the MSDN has more explaination "Embedded And Linked resources"
If you set the build action for a WPF item to be "Resource", you can leverage embeded resource as supported by the core .NET framewor, but adds support for accessing the embedded resource via a pack UI, from MSDN:
WPF resource files are not the same as the embedded or linked type of resources that can be configured using the core .NET Framework support for assembly resources. While WPF resource files do leverage the core .NET Framework embedded resource support, the ability to access WPF resource files using pack URIs is easier than using namespaces.
Also, there is some detailed explaination on different build action and how it affect the build output for the items.
What are the various “Build action” settings in VS.NET project properties and what do they 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: Allows you to retrieve a file (in same dir as assembly) as a stream via Application.GetContentStream( uri ). For this method to work, it needs a AssemblyAssociatedContentFile custom attribute which VS graciously adds when you mark a file as "Custom"
-
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
xamlfile intobaml. Thebamlis then embedded with the same technique asResource(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
SplashScreenis shown automatically when an WPF application loads, and then fades -
DesignData: unknown
-
DesignDataWithDesignTimeCreatableTypes: unknown
-
EntityDeploy: (Entity Framework): used to deploy the Entity Framework artifacts
本文详细解释了C#应用中资源和嵌入式资源的概念及用法,包括如何通过Uris访问WPF资源,以及不同类型的资源文件在核心.NET框架和支持的差异。此外,还介绍了各种构建行动设置及其对项目输出的影响,如无、编译、内容、嵌入资源等。
1478

被折叠的 条评论
为什么被折叠?



