Retrieves the full identity of a Microsoft component based on the component name and the component language. Namespace: Microsoft.ComponentStudio.ComponentPlatformInterface
Assembly: Microsoft.ComponentStudio.ComponentPlatformInterface (in microsoft.componentstudio.componentplatforminterface.dll)

Usage

Visual Basic
Dim name As String
Dim language As String
Dim returnValue As Identity
Dim offlineImage1 As OfflineImage
returnValue = offlineImage1.FindComponentIdentity(name, language)

Syntax

Visual Basic
Overloads Public Function FindComponentIdentity( _
		ByVal name As String, _
		ByVal language As String _
) As Identity
C#
public Identity FindComponentIdentity(
		string name, 
		string language
);
C++
public:
Identity^ FindComponentIdentity(
		String^ name,
		String^ language
);
J#
public Identity FindComponentIdentity(
		System.String name, 
		System.String language
);
JScript
public function FindComponentIdentity(
		 name : String, 
		 language : String
) : Identity;

Parameters

name

Name of component to be searched for.

language

Language of the component.

Return Value

The full identity of the Microsoft component.

Example

In this example, you add a RunOnce command to the answer file and save the answer file with a different file name.

noteNote:
To run this example, you must change the value of the variable wimPath to the folder name that contains the .wim file on you computer.
// OfflineImage2.cs

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ComponentStudio.ComponentPlatformInterface;

namespace OfflineImage2
{
	class Program
	{
		public static void Main()
		{
			string wimPath = @"C:\myWorkingFolder\install.wim";

			// Create a Cpi instance:
			Cpi n = Cpi.Instance;

			// Check if the catalog file is created, if not create one:
			WimInfo wInfo = n.OpenWim(wimPath);
			if (!wInfo.Images[0].ValidateCatalog().Succeeded)
				wInfo.Images[0].CreateCatalog();

			// Open the offline image:
			OfflineImage img = n.OpenOfflineImage(wInfo.Images[0]);

			// Get the answer file:
			AnswerFile an = n.CreateAnswerFile(img);

			// Set a configuration pass:
			ConfigurationPass pass = (ConfigurationPass)3;

			// Find the identity of the Shell  component in the image:
			Identity shellID =
			 img.FindComponentIdentity(
			 RunOnceCommand.GetApplicableComponentName(pass));

			// Create the Shell component in the answer file:
			AnswerFileComponentSetting shellComponent =
			an.ComponentSettings.Create(
			shellID, pass, CreateOptions.ReturnExisting);

			// Save the answer file under a new name:
			String newAnsF = @"C:\myWorkingFolder\My newUnattend.xml";
			an.SaveAs(newAnsF);
			Console.WriteLine("The new answer file is saved as {0}.",
			 newAnsF);
	}
}
}
/* Output:
The new answer file is saved as C:\myWorkingFolder\My newUnattend.xml.
*/

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Vista, and Windows 2000

Target Platforms

See Also