Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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; } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartZoneAutoFormat.cs
- XmlAttributes.cs
- WebPartsSection.cs
- XsltException.cs
- PerformanceCounterPermissionEntryCollection.cs
- DataBoundControlDesigner.cs
- DeclarativeExpressionConditionDeclaration.cs
- ComponentResourceManager.cs
- PropertyTabAttribute.cs
- WorkflowTransactionService.cs
- WebBrowser.cs
- WebPartUtil.cs
- DataGridColumnCollection.cs
- MissingMemberException.cs
- X509Certificate.cs
- xml.cs
- ArglessEventHandlerProxy.cs
- SizeIndependentAnimationStorage.cs
- UshortList2.cs
- PageContentAsyncResult.cs
- SystemIPGlobalStatistics.cs
- DataDocumentXPathNavigator.cs
- TimeSpanOrInfiniteConverter.cs
- CollectionViewGroupRoot.cs
- TargetInvocationException.cs
- ValueProviderWrapper.cs
- VisualTarget.cs
- TransformCollection.cs
- XmlSerializerNamespaces.cs
- Header.cs
- PeerDefaultCustomResolverClient.cs
- EmbeddedMailObject.cs
- UInt32.cs
- CaseStatementSlot.cs
- JsonMessageEncoderFactory.cs
- ObjectContextServiceProvider.cs
- TextTreeTextNode.cs
- InstanceNameConverter.cs
- PathSegmentCollection.cs
- Accessors.cs
- CriticalExceptions.cs
- PerformanceCounterPermissionAttribute.cs
- SemanticResultValue.cs
- SvcMapFileLoader.cs
- IRCollection.cs
- SerializationInfo.cs
- Matrix3DValueSerializer.cs
- RemoteWebConfigurationHost.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- MemberInfoSerializationHolder.cs
- SqlInfoMessageEvent.cs
- WaitHandleCannotBeOpenedException.cs
- ResourceCodeDomSerializer.cs
- ConsoleKeyInfo.cs
- XhtmlBasicValidationSummaryAdapter.cs
- SqlProvider.cs
- InkCanvasFeedbackAdorner.cs
- InkSerializer.cs
- FrameDimension.cs
- PlacementWorkspace.cs
- StrongNameKeyPair.cs
- SatelliteContractVersionAttribute.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- RtfControls.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- GenericsInstances.cs
- GeometryHitTestResult.cs
- Int32CAMarshaler.cs
- ModelItemKeyValuePair.cs
- SpecularMaterial.cs
- CodeIndexerExpression.cs
- TypedCompletedAsyncResult.cs
- OpCopier.cs
- DbConnectionOptions.cs
- TypedLocationWrapper.cs
- ConsumerConnectionPoint.cs
- CodeMethodInvokeExpression.cs
- NativeMethods.cs
- WebServicesDescriptionAttribute.cs
- PersonalizableAttribute.cs
- designeractionbehavior.cs
- GenericAuthenticationEventArgs.cs
- AnimationStorage.cs
- LogExtentCollection.cs
- HandleRef.cs
- OracleSqlParser.cs
- TCPListener.cs
- HotSpotCollection.cs
- StorageInfo.cs
- ArraySortHelper.cs
- DefinitionBase.cs
- WindowHideOrCloseTracker.cs
- LogWriteRestartAreaAsyncResult.cs
- ZoneIdentityPermission.cs
- ToolboxItemFilterAttribute.cs
- IndicShape.cs
- AppearanceEditorPart.cs
- DelimitedListTraceListener.cs
- HttpResponse.cs
- PrintPreviewControl.cs