Represents the identity of a Windows component. Namespace: Microsoft.ComponentStudio.ComponentPlatformInterface
Assembly: Microsoft.ComponentStudio.ComponentPlatformInterface (in microsoft.componentstudio.componentplatforminterface.dll)

Usage

Visual Basic
Dim name As String
Dim publicKeyToken As String
Dim version As Version
Dim processorArchitecture As String
Dim language As String
Dim versionScope As String
Dim identity1 As New Identity(name, publicKeyToken, version, processorArchitecture, language, versionScope)

Syntax

Visual Basic
Public Class Identity
C#
public class Identity
C++
public ref class Identity
J#
public class Identity
JScript
public class Identity

Example

In this example, you declare and initialize an identity variable, parse it, and then retrieve its properties.

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

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

namespace MyNameSpace
{
	class MyProgram
	{
		static void Main(string[] args)
		{
			string myWim = @"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(myWim);
			if (!wInfo.Images[0].ValidateCatalog().Succeeded)
				wInfo.Images[0].CreateCatalog();

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

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

			// Declare 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:
			string myAnsF = @"C:\myWorkingFolder\myUnattend.xml";
			an.SaveAs(myAnsF);

			// Display success message:
			Console.WriteLine("The new answer file is saved as {0}.",
			myAnsF);
	}
}
}
/* Output:
The new answer file is saved as C:\myWorkingFolder\myUnattend.xml.
*/

Remarks

The properties of this class are derived from the assembly manifest schema for each component. For a detailed description of each property, see assembly manifests in the MSDN Library.


Inheritance Hierarchy

System.Object
  Microsoft.ComponentStudio.ComponentPlatformInterface.Identity

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