Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Configuration / GacUtil.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StylusDevice.cs
- CodeTypeParameterCollection.cs
- WebPartDisplayModeEventArgs.cs
- ListControlBuilder.cs
- DataGridViewComboBoxEditingControl.cs
- DataGridViewTextBoxCell.cs
- FloatSumAggregationOperator.cs
- XmlLinkedNode.cs
- ScriptingRoleServiceSection.cs
- ProtocolViolationException.cs
- DateBoldEvent.cs
- Sequence.cs
- ReadOnlyTernaryTree.cs
- ActivityInterfaces.cs
- KeyNotFoundException.cs
- Scheduling.cs
- BackgroundWorker.cs
- KeyboardDevice.cs
- _SSPIWrapper.cs
- MappingMetadataHelper.cs
- BaseComponentEditor.cs
- SafeRightsManagementEnvironmentHandle.cs
- GACIdentityPermission.cs
- SqlDataSourceView.cs
- RequestDescription.cs
- XmlNamedNodeMap.cs
- ListDependantCardsRequest.cs
- AbandonedMutexException.cs
- ConfigXmlWhitespace.cs
- Clock.cs
- InputScopeAttribute.cs
- QueryAccessibilityHelpEvent.cs
- Thumb.cs
- ICspAsymmetricAlgorithm.cs
- BinaryFormatter.cs
- IfJoinedCondition.cs
- ChangePassword.cs
- UnsafeNativeMethods.cs
- DataGridViewCellValidatingEventArgs.cs
- BufferModesCollection.cs
- ConstructorBuilder.cs
- FontCacheUtil.cs
- StylusSystemGestureEventArgs.cs
- OpCopier.cs
- Binding.cs
- keycontainerpermission.cs
- ErrorWrapper.cs
- ReflectionServiceProvider.cs
- ReflectionUtil.cs
- CharacterMetrics.cs
- ProcessProtocolHandler.cs
- EventMemberCodeDomSerializer.cs
- XmlTextReaderImplHelpers.cs
- FixedSOMLineCollection.cs
- FixedSOMFixedBlock.cs
- BinHexEncoder.cs
- WebPartVerbsEventArgs.cs
- NotifyIcon.cs
- Debug.cs
- SqlUtil.cs
- _AuthenticationState.cs
- UrlUtility.cs
- LayoutEditorPart.cs
- StoreAnnotationsMap.cs
- BindingNavigatorDesigner.cs
- MILUtilities.cs
- FormatConvertedBitmap.cs
- TrackingMemoryStream.cs
- WebPartsPersonalization.cs
- XsdDateTime.cs
- BrowserTree.cs
- DropShadowBitmapEffect.cs
- Roles.cs
- Bitmap.cs
- ObjectCache.cs
- StubHelpers.cs
- BinaryReader.cs
- HttpHandlerActionCollection.cs
- SupportsEventValidationAttribute.cs
- Highlights.cs
- ModifierKeysConverter.cs
- DesignerProperties.cs
- HealthMonitoringSectionHelper.cs
- PasswordDeriveBytes.cs
- XmlAnyElementAttribute.cs
- ResXDataNode.cs
- ExpressionPrinter.cs
- PropertyGridEditorPart.cs
- TextParentUndoUnit.cs
- CacheRequest.cs
- NativeMethods.cs
- WeakEventManager.cs
- SkipQueryOptionExpression.cs
- CollectionChange.cs
- SaveFileDialog.cs
- PolicyChain.cs
- WindowsFormsHost.cs
- FormsIdentity.cs
- TemplateKeyConverter.cs
- DataGridPagerStyle.cs