本文整理汇总了C#中System.Configuration.Install.AssemblyInstaller类的典型用法代码示例。如果您正苦于以下问题:C# AssemblyInstaller类的具体用法?C# AssemblyInstaller怎么用?C# AssemblyInstaller使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AssemblyInstaller类属于System.Configuration.Install命名空间,在下文中一共展示了AssemblyInstaller类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Configuration.Install;
using System.Collections;
using System.Collections.Specialized;
class AssemblyInstaller_Example
{
static void Main()
{
IDictionary mySavedState = new Hashtable();
Console.WriteLine( "" );
try
{
// Set the commandline argument array for 'logfile'.
string[] commandLineOptions = new string[ 1 ] {"/LogFile=example.log"};
// Create an object of the 'AssemblyInstaller' class.
AssemblyInstaller myAssemblyInstaller = new
AssemblyInstaller( "MyAssembly.exe" , commandLineOptions );
myAssemblyInstaller.UseNewContext = true;
// Install the 'MyAssembly' assembly.
myAssemblyInstaller.Install( mySavedState );
// Commit the 'MyAssembly' assembly.
myAssemblyInstaller.Commit( mySavedState );
}
catch (ArgumentException)
{
}
catch (Exception e)
{
Console.WriteLine( e.Message );
}
}
}