Export (0) Print
Expand All

Determining the Default Namespace

For Visual Basic, if the CustomToolNamespace property is set on the input file, then the value of CustomToolNamespace becomes the value of the default namespace parameter passed to the Generate method. Otherwise, the wszDefaultNamespace parameter passed to Generate is always equal to the root namespace. For more information on namespaces, see Namespace Keywords (C# Reference).

Visual C# uses folder-based namespaces. That is, the namespace consists of the root namespace, plus names of any folders containing the custom tool. Each folder name is converted into a valid identifier, and periods separate all names. For example, if the input file is FolderA\FolderB\FolderC\MyInput.txt, and the root namespace is CL9, then the computed default namespace would be CL9.FolderA.FolderB.FolderC.

An exception to this rule occurs when the hierarchy chain contains a Web reference folder. For example, if:

  • FolderC were a Web reference folder, the namespace would be CL9.FolderC.

  • FolderB were a Web reference folder, the namespace would be CL9.FolderB.FolderC.

That is, the namespace uses the following format:

rootNamespace.webReferenceFolder.containedFolder.containedFolder ...
© 2014 Microsoft