AssemblyInstaller.UseNewContext 屬性

定義

取得或設定值,指出是否為組件的安裝建立新 InstallContext 物件。

public:
 property bool UseNewContext { bool get(); void set(bool value); };
public bool UseNewContext { get; set; }
member this.UseNewContext : bool with get, set
Public Property UseNewContext As Boolean

屬性值

如果應該為組件的安裝建立新 InstallContext 物件,則為 true,否則為 false。 預設為 true

範例

在下列範例中, AssemblyInstaller 會叫用 建構函式來 AssemblyInstaller 建立 。 這個 UseNewContext 物件的 屬性會設定為 true ,並在 Install 元件上 MyAssembly_HelpText.exe 叫用 方法。 因此,記錄訊息會顯示在控制臺上。

// Create an Object* of the 'AssemblyInstaller' class.
AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller(
   "MyAssembly_HelpText.exe", commandLineOptions );

// Set the 'UseNewContext' property to true.
myAssemblyInstaller->UseNewContext = true;
// Create an object of the 'AssemblyInstaller' class.
AssemblyInstaller myAssemblyInstaller = new
               AssemblyInstaller( "MyAssembly_HelpText.exe", commandLineOptions );

// Set the 'UseNewContext' property to true.
myAssemblyInstaller.UseNewContext = true;
' Create an object of the 'AssemblyInstaller' class.
Dim myAssemblyInstaller As _
   New AssemblyInstaller("MyAssembly_HelpText.exe", commandLineOptions)

' Set the 'UseNewContext' property to true.
myAssemblyInstaller.UseNewContext = True

備註

將此屬性設定為 true 建立名為 「{Assembly name} 的新檔案。InstallLog“ 可記錄此元件的訊息。 設定 UseNewContext 以防止 false 新檔案建立。

適用於