Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / Configuration / GacUtil.cs / 1 / GacUtil.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Web.Configuration; using System.Runtime.InteropServices; using System.Security.Permissions; /* class for installing ASP.BrowserCapabilitiesFactory into gac */ internal sealed class GacUtil : IGac { [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] public void GacInstall(string assemblyPath) { #if !FEATURE_PAL IAssemblyCache ac = null; int hr = NativeMethods.CreateAssemblyCache(out ac, 0); if (0 == hr) hr = ac.InstallAssembly(0, assemblyPath, IntPtr.Zero); #else // !FEATURE_PAL int hr = -1; try { Process gacutilprocess = new System.Diagnostics.Process(); if (gacutilprocess != null) { gacutilprocess.StartInfo.CreateNoWindow = true; #if PLATFORM_UNIX gacutilprocess.StartInfo.FileName = "gacutil"; #else gacutilprocess.StartInfo.FileName = "gacutil.exe"; #endif gacutilprocess.StartInfo.UseShellExecute = false; gacutilprocess.StartInfo.Arguments = "/i " + assemblyPath; gacutilprocess.Start(); while (!gacutilprocess.HasExited) { Thread.Sleep(250); } hr = gacutilprocess.ExitCode; } } catch (Exception) { hr = -1; } #endif // FEATURE_PAL if (0 != hr) { throw new Exception(SR.GetString(SR.Failed_gac_install)); } } [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] public bool GacUnInstall(string assemblyName) { IAssemblyCache ac = null; uint position = 0; int hr = NativeMethods.CreateAssemblyCache(out ac, 0); if (0 == hr) { hr = ac.UninstallAssembly(0, assemblyName, IntPtr.Zero, out position); if (position == 3 /*IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED*/) { return false; } } if (0 != hr) { throw new Exception(SR.GetString(SR.Failed_gac_uninstall)); } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConfigurationLoaderException.cs
- HandlerMappingMemo.cs
- StrokeNode.cs
- ColorConverter.cs
- ActivationServices.cs
- BindingManagerDataErrorEventArgs.cs
- DataGridViewComboBoxEditingControl.cs
- CodeMemberProperty.cs
- Token.cs
- IndexedString.cs
- MethodImplAttribute.cs
- XmlSchemaValidationException.cs
- ListViewGroupConverter.cs
- DataGridViewButtonCell.cs
- PositiveTimeSpanValidator.cs
- SecurityTokenSerializer.cs
- FormsIdentity.cs
- ClassHandlersStore.cs
- AccessedThroughPropertyAttribute.cs
- SortKey.cs
- DesignerForm.cs
- ListDictionaryInternal.cs
- BrowserCapabilitiesFactoryBase.cs
- ComponentCollection.cs
- IgnoreSectionHandler.cs
- CornerRadiusConverter.cs
- TransformerConfigurationWizardBase.cs
- Line.cs
- ProcessProtocolHandler.cs
- Int64KeyFrameCollection.cs
- TextShapeableCharacters.cs
- SimpleWebHandlerParser.cs
- QueryContinueDragEventArgs.cs
- PageBreakRecord.cs
- XmlName.cs
- XmlWrappingWriter.cs
- ProxyWebPartManager.cs
- ParallelTimeline.cs
- FaultReason.cs
- PreservationFileReader.cs
- GridToolTip.cs
- DeferredRunTextReference.cs
- XPathEmptyIterator.cs
- Part.cs
- DoubleLink.cs
- MobileListItem.cs
- ZipIOLocalFileDataDescriptor.cs
- LassoHelper.cs
- SafeHandles.cs
- CommandManager.cs
- XmlSubtreeReader.cs
- GridToolTip.cs
- PartitionResolver.cs
- DrawingState.cs
- StyleCollectionEditor.cs
- PasswordTextContainer.cs
- DefaultTraceListener.cs
- AsyncPostBackTrigger.cs
- TypeProvider.cs
- EmbeddedMailObject.cs
- VSDExceptions.cs
- KoreanLunisolarCalendar.cs
- XmlSchemaObjectCollection.cs
- ObjectDataSource.cs
- CqlWriter.cs
- XdrBuilder.cs
- ComponentSerializationService.cs
- AllMembershipCondition.cs
- LabelLiteral.cs
- SqlCacheDependencyDatabase.cs
- Form.cs
- EntityDataSourceWizardForm.cs
- RightsManagementLicense.cs
- XsdBuildProvider.cs
- Pair.cs
- DataGridItem.cs
- RuleSettings.cs
- WebConfigurationHostFileChange.cs
- DesignerTransaction.cs
- XPathScanner.cs
- LockRecoveryTask.cs
- TabItemAutomationPeer.cs
- XPathDocumentIterator.cs
- MDIClient.cs
- PrintControllerWithStatusDialog.cs
- ColorContext.cs
- X509CertificateValidator.cs
- DependencyPropertyKey.cs
- ExpressionVisitor.cs
- DesignerFrame.cs
- XsdDateTime.cs
- XPathChildIterator.cs
- SettingsPropertyWrongTypeException.cs
- MailMessageEventArgs.cs
- RuntimeConfig.cs
- FlowDocumentScrollViewer.cs
- unitconverter.cs
- WebPartUserCapability.cs
- TimelineCollection.cs
- HttpApplicationStateBase.cs