예제 #1
0
 internal RegistrationThreadWrapper(RegistrationHelper helper,
                                    RegistrationConfig regConfig)
 {
     DBG.Info(DBG.Registration, "STA Thread!  jumping onto MTA for registration");
     _regConfig = regConfig;
     _helper    = helper;
     _exception = null;
 }
예제 #2
0
파일: Class1.cs 프로젝트: rojac07/COM
 static void Main(string[] args)
 {
     // Register a private assembly.
     RegistrationHelper rh = new RegistrationHelper();
     try
     {
         string comPlusAppName = "NewComPlusApp";
         string typeLibName = "FooServicedComp.tlb";
         rh.InstallAssembly("FooServicedComp.dll",
             ref comPlusAppName,
             ref typeLibName,
             InstallationFlagsFindOrCreateTargetApplication);
     }
     catch(RegistrationException rhex)
     {
         Console.WriteLine(rhex.Message);
     }
 }
예제 #3
0
        // Install an assembly given configuration information.
        public void InstallAssemblyFromConfig
            (ref RegistrationConfig regConfig, Object sync)
        {
            RegistrationHelper helper;
            bool complete = false;

            try
            {
                helper = new RegistrationHelper();
                helper.InstallAssemblyFromConfig(ref regConfig);
                ContextUtil.SetComplete();
                complete = true;
            }
            finally
            {
                if (!complete)
                {
                    ContextUtil.SetAbort();
                }
            }
        }
예제 #4
0
 /// <summary>
 /// When overridden in a derived class, performs the installation.
 /// </summary>
 /// <param name="stateSaver">An <see cref="T:System.Collections.IDictionary"/> used to save information needed to perform a commit, rollback, or uninstall operation.</param>
 public override void Install(IDictionary stateSaver)
 {
     base.Install(stateSaver);
     string appID = string.Empty;
     string typeLib = string.Empty;
     // Get the location of the current assembly
     string assemblyLocation = GetType().Assembly.Location;
     // Install the application
     try
     {
         RegistrationHelper regHelper = new RegistrationHelper();
         regHelper.InstallAssembly(assemblyLocation, ref appID, ref typeLib, InstallationFlags.FindOrCreateTargetApplication);
         // Save the state - you will need this for the uninstall
         stateSaver.Add("AppID", appID);
         stateSaver.Add("Assembly", assemblyLocation);
     }
     catch (Exception ex)
     {
         throw new InstallException("Error during registration of " + GetType().Assembly.FullName, ex);
     }
 }
예제 #5
0
 /// <summary>
 /// When overridden in a derived class, removes an installation.
 /// </summary>
 /// <param name="savedState">An <see cref="T:System.Collections.IDictionary"/> that contains the state of the computer after the installation was complete.</param>
 public override void Uninstall(IDictionary savedState)
 {
     try
     {
         // Get the state created when the app was installed
         string appID = (string)savedState["AppID"];
         string assembly = (string)savedState["Assembly"];
         // Uninstall the application
         RegistrationHelper regHelper = new RegistrationHelper();
         regHelper.UninstallAssembly(assembly, appID);
     }
     catch (Exception) { }
     finally
     {
         base.Uninstall(savedState);
     }
 }
 internal RegistrationThreadWrapper(RegistrationHelper helper, RegistrationConfig regConfig)
 {
     this._regConfig = regConfig;
     this._helper    = helper;
     this._exception = null;
 }
	// Install an assembly given configuration information.
	public void InstallAssemblyFromConfig
				(ref RegistrationConfig regConfig, Object sync)
			{
				RegistrationHelper helper;
				bool complete = false;
				try
				{
					helper = new RegistrationHelper();
					helper.InstallAssemblyFromConfig(ref regConfig);
					ContextUtil.SetComplete();
					complete = true;
				}
				finally
				{
					if(!complete)
					{
						ContextUtil.SetAbort();
					}
				}
			}
 internal RegistrationThreadWrapper(RegistrationHelper helper, RegistrationConfig regConfig)
 {
     this._regConfig = regConfig;
     this._helper = helper;
     this._exception = null;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="assemblyFile"></param>
        public void UnregisterServicedComponents(FileInfo assemblyFile)
        {
            RegistrationConfig config = new RegistrationConfig();
            config.Application = applicationName;
            config.AssemblyFile = assemblyFile.FullName;
            config.InstallationFlags = InstallationFlags.ReportWarningsToConsole | InstallationFlags.FindOrCreateTargetApplication | InstallationFlags.ReconfigureExistingApplication;

            RegistrationHelper regHelper = new RegistrationHelper();
            regHelper.UninstallAssemblyFromConfig(ref config);
        }