Assembly: Microsoft.ComponentStudio.ComponentPlatformInterface (in microsoft.componentstudio.componentplatforminterface.dll)
Usage
Visual Basic |
---|
Dim answerFileSettingOverride1 As AnswerFileSettingOverride |
Syntax
Visual Basic |
---|
Public Class AnswerFileSettingOverride Inherits SettingOverride Implements IAnswerFileSettingOverrideContainer, ISettingOverrideContainer, IXmlSerializable, IRemovable |
C# |
---|
public class AnswerFileSettingOverride : SettingOverride, IAnswerFileSettingOverrideContainer, ISettingOverrideContainer, IXmlSerializable, IRemovable |
C++ |
---|
public ref class AnswerFileSettingOverride : SettingOverride, IAnswerFileSettingOverrideContainer, ISettingOverrideContainer, IXmlSerializable, IRemovable |
J# |
---|
public class AnswerFileSettingOverride extends SettingOverride implements IAnswerFileSettingOverrideContainer, ISettingOverrideContainer, IXmlSerializable, IRemovable |
JScript |
---|
public class AnswerFileSettingOverride extends SettingOverride implements IAnswerFileSettingOverrideContainer, , ISettingOverrideContainer, , IXmlSerializable, , IRemovable |
Example
In this example, you open an offline image file (install.wim) and an answer file (My Unattend1.xml) from the specified paths on your hard drive. You create a setting override for Home Page and CompanyName, and then you save the new settings in a new answer file, My Unattend12.xml.
Note: |
---|
To run this example, you must change the value of the variable
wimPath to match the path that contains the .wim file
on your computer. You also must change the value of the variable
ansFile to match the name of the answer file on your
computer. |
// AnsFileOverrides.cs using System; using System.Collections.Generic; using System.Text; using Microsoft.ComponentStudio.ComponentPlatformInterface; namespace MyNameSpace { class MyClass { static void Main(string[] args) { string wimPath = @"C:\myWorkingFolder"; string wimFile = wimPath + @"\install.wim"; string ansFile = wimPath + @"\My Unattend1.xml"; // Create a Cpi instance: Cpi n = Cpi.Instance; // Check if the catalog file is created: WimInfo wimInfo = n.OpenWim(wimFile); wimInfo.Images[0].CreateCatalog(); // Open the offline image: OfflineImage img = n.OpenOfflineImage(wimInfo.Images[0]); // Get the answer file: AnswerFile an = n.OpenAnswerFile(ansFile); Console.WriteLine("The answer file: {0}", an); // Find the IE component in the offline image: Identity id = img.FindComponentIdentity( "Microsoft-Windows-IE-InternetExplorer"); // Create a setting override for Home_Page: AnswerFileSettingOverride homePage = an.SettingOverrides.Create(id, "Home_Page", ConfigurationPass.specialize, CreateOptions.ReturnExisting); // Change the Home_Page value: homePage.Value = "www.microsoft.com"; Console.WriteLine("New home page: {0}", homePage.Value); // Create a setting override for company name: AnswerFileSettingOverride companyName = an.SettingOverrides.Create(id, "CompanyName", ConfigurationPass.specialize, CreateOptions.ReturnExisting); // Change the CompanyName value: companyName.Value = "Microsoft, Inc."; Console.WriteLine("New CompanyName: {0}", companyName.Value); // Save the file: an.SaveAs(wimPath + @"My Unattend12.xml"); } } } /* Output: The answer file: Microsoft.ComponentStudio.ComponentPlatformInterface.AnswerFile New home page: www.microsoft.com New CompanyName: Microsoft, Inc. */ |
Inheritance Hierarchy
System.Object
Microsoft.ComponentStudio.Common.ObjectBase
Microsoft.ComponentStudio.ComponentPlatformInterface.SettingOverride
Microsoft.ComponentStudio.ComponentPlatformInterface.AnswerFileSettingOverride
Microsoft.ComponentStudio.ComponentPlatformInterface.DriverPath
Microsoft.ComponentStudio.ComponentPlatformInterface.RunOnceCommand
Microsoft.ComponentStudio.Common.ObjectBase
Microsoft.ComponentStudio.ComponentPlatformInterface.SettingOverride
Microsoft.ComponentStudio.ComponentPlatformInterface.AnswerFileSettingOverride
Microsoft.ComponentStudio.ComponentPlatformInterface.DriverPath
Microsoft.ComponentStudio.ComponentPlatformInterface.RunOnceCommand
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.