共用方式為


AssignCulture Class

Definition

Class: AssignCulture

This task takes a list of resource file names and sets an attribute that contains the culture name embedded in the file name:

 MyResources.fr.resx     ==> Culture='fr'

The task can also return a list of "Culture-neutral" file names, like:

 MyGlyph.fr.bmp          ==> MyGlyph.bmp [Culture='fr']

This is because embedded resources are referred to this way.

There are plenty of corner cases with this task. See the unit test for more details.

This API supports the product infrastructure and is not intended to be used directly from your code.

public ref class AssignCulture : Microsoft::Build::Tasks::TaskExtension
public class AssignCulture : Microsoft.Build.Tasks.TaskExtension
type AssignCulture = class
    inherit TaskExtension
Public Class AssignCulture
Inherits TaskExtension
Inheritance
AssignCulture

Constructors

AssignCulture()

This API supports the product infrastructure and is not intended to be used directly from your code.

Initializes a new instance of the AssignCulture class.

Properties

AssignedFiles

This API supports the product infrastructure and is not intended to be used directly from your code.

This outgoing list of files is exactly the same as the incoming Files list except that an attribute name "Culture" will have been added if the particular file name is in the form:

 MyResource.<any-valid-culture-id>.resx

The value of Culture will be "<any-valid-culture-id>".

If the incoming item from Files already has a Culture attribute then that original attribute is used instead.

AssignedFilesWithCulture

This API supports the product infrastructure and is not intended to be used directly from your code.

This is a subset of AssignedFiles that has all of the items that ended up have a Culture assigned to them. This includes items that already had a Culture in the incoming Files list as well as items that were assigned a Culture because they had a valid culture ID embedded in their file name.

The following is always true:

 AssignedFiles = AssignedFilesWithCulture + AssignedFilesWithNoCulture
AssignedFilesWithNoCulture

This API supports the product infrastructure and is not intended to be used directly from your code.

This is a subset of AssignedFiles that has all of the items that ended up with no Culture assigned to them.

The following is always true:

 AssignedFiles = AssignedFilesWithCulture + AssignedFilesWithNoCulture
BuildEngine

The build engine automatically sets this property to allow tasks to call back into it.

(Inherited from Task)
BuildEngine2

The build engine automatically sets this property to allow tasks to call back into it. This is a convenience property so that task authors inheriting from this class do not have to cast the value from IBuildEngine to IBuildEngine2.

(Inherited from Task)
BuildEngine3

Retrieves the IBuildEngine3 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine4

Retrieves the IBuildEngine4 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine5

Retrieves the IBuildEngine5 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine6

Retrieves the IBuildEngine6 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine7

Retrieves the IBuildEngine7 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine8

Retrieves the IBuildEngine8 version of the build engine interface provided by the host.

(Inherited from Task)
BuildEngine9

Retrieves the IBuildEngine9 version of the build engine interface provided by the host.

(Inherited from Task)
CultureNeutralAssignedFiles

This API supports the product infrastructure and is not intended to be used directly from your code.

This list has the same number of items as the Files list or the AssignedFiles list.

Items in this list have the file name from Files or AssignedFiles but with the culture stripped if it was embedded in the file name.

So for example, if the incoming item in Files was:

 MyBitmap.fr.bmp

then the corresponding file in CultureNeutralAssignedFiles will be:

 MyBitmap.bmp

The culture will only be stripped if it is a valid culture identifier. So for example,

 MyCrazyFile.XX.txt

will result in exactly the same file name:

 MyCrazyFile.XX.txt

because 'XX' is not a valid culture identifier.

Files

This API supports the product infrastructure and is not intended to be used directly from your code.

The incoming list of files to assign a culture to.

HelpKeywordPrefix

Gets or sets the prefix used to compose help keywords from string resource names. If a task does not have help keywords associated with its messages, it can ignore this property or set it to null. If the prefix is set to an empty string, then string resource names will be used verbatim as help keywords. For an example of how this prefix is used, see the TaskLoggingHelper.LogErrorWithCodeFromResources(string, object[]) method.

(Inherited from Task)
HostObject

The build engine sets this property if the host IDE has associated a host object with this particular task.

(Inherited from Task)
Log

This API supports the product infrastructure and is not intended to be used directly from your code.

Gets an instance of a TaskLoggingHelperExtension class containing task logging methods.

(Inherited from TaskExtension)
RespectAlreadyAssignedItemCulture

If the flag set to 'true' the incoming list with existing Culture metadata will not be ammended and CultureNeutralAssignedFiles filename will be equal to the original. In case the Culture metadata was not provided, the logic of RespectAlreadyAssignedItemCulture will not take any effect.

TaskResources

Gets or sets the task's culture-specific resources. Derived classes should register their resources either during construction, or via this property, if they have localized strings.

(Inherited from Task)

Methods

Execute()

This API supports the product infrastructure and is not intended to be used directly from your code.

Execute.

Applies to