Windows Phone development (4): Windows Phone build action

Source: Internet
Author: User

During WP development, we often encounter problems where images cannot be displayed, videos and music cannot be played, and addresses are correct. What's the reason, according to the msdn study, the build action was improperly set.

Right-click the resource file and select Properties to open the Properties window, for example:

In the build action of the WP resource file, we often use the following situations:

    • None: This file will be ignored and will not participate in compilation and output.
    • Compile: Files will be compiled into Microsoft intermediate language (IL), such as files with a file extension of CS
    • Content: The file will be packaged into the xap file and used as an independent file
    • Page: In WP, all XAML page files belong to pages, except app. XAML files.
    • Resource: The file will be compiled into the. dll file of the xap file package.

How do we select the build action of the resource file?

Before speaking, we have to talk about how to access the resource file path in the case of content and resource;

    • Content: The Path to the resource file is relatively simple, such "/../.."
    • Resource: The Path for accessing resource files is cumbersome, such as "/phoneapp1; component/images/back.png", phoneapp1 is the project name, and component is the fixed name.

Image files

As mentioned in the previous section, the layers of ApplicationBar and Silverlight are completely separated in WP, so there are two situations:

The icon file of ApplicationBar should be set to the content method, and the Silverlight level should be set to the resource method.

Multimedia files

For example, for music and video files, these resource files should be set to the content mode.

Why? Microsoft provides the following explanation:

Set build action to content for Media

Media Processing on Windows Phone is optimized to use files and network streams, but not in-memory streams. This means that any media files have been ded in the application, such as sound effects, shocould have theirBuild actionSetContentAnd notResource.

For more information, see performance considerations in applications for Windows Phone.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.