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
- ChannelDispatcherCollection.cs
- WebPartConnectionCollection.cs
- ExceptionHelpers.cs
- NonSerializedAttribute.cs
- Visitor.cs
- SymbolTable.cs
- ProtocolsConfigurationHandler.cs
- MatrixTransform.cs
- TreeNodeBindingCollection.cs
- RIPEMD160Managed.cs
- EmptyQuery.cs
- CqlIdentifiers.cs
- ScrollEventArgs.cs
- SqlWorkflowInstanceStore.cs
- DelegatingStream.cs
- DecimalConverter.cs
- WriteFileContext.cs
- XmlUtf8RawTextWriter.cs
- UnsafeNativeMethods.cs
- webproxy.cs
- SystemParameters.cs
- MutableAssemblyCacheEntry.cs
- InternalBufferOverflowException.cs
- CaseStatement.cs
- ToolStripDropDownMenu.cs
- QuaternionConverter.cs
- FileVersionInfo.cs
- StateRuntime.cs
- AnnotationAuthorChangedEventArgs.cs
- MonitorWrapper.cs
- WinCategoryAttribute.cs
- JournalEntryStack.cs
- PolyBezierSegment.cs
- Internal.cs
- IdnElement.cs
- documentsequencetextpointer.cs
- FacetChecker.cs
- CurrentTimeZone.cs
- Object.cs
- Char.cs
- DescriptionAttribute.cs
- RuleRef.cs
- BuildProvider.cs
- DataGridViewBand.cs
- TextRange.cs
- SmiConnection.cs
- NavigationWindowAutomationPeer.cs
- TableLayoutPanelCellPosition.cs
- RijndaelManagedTransform.cs
- RegexCompiler.cs
- ObjectDataSourceMethodEventArgs.cs
- ListView.cs
- ObjectKeyFrameCollection.cs
- LayoutEngine.cs
- UserNameSecurityToken.cs
- BoundField.cs
- BitmapEffectRenderDataResource.cs
- SuspendDesigner.cs
- Subset.cs
- X509ChainPolicy.cs
- EntitySetRetriever.cs
- NavigationService.cs
- XPathNavigatorReader.cs
- PagesSection.cs
- dtdvalidator.cs
- ListCollectionView.cs
- DataGridViewCellEventArgs.cs
- RoutedEventConverter.cs
- XpsSerializationException.cs
- DependencySource.cs
- RSAOAEPKeyExchangeDeformatter.cs
- DesignerCategoryAttribute.cs
- DataStreams.cs
- XmlTextWriter.cs
- GlyphsSerializer.cs
- InstanceData.cs
- StrokeDescriptor.cs
- Table.cs
- NativeMethods.cs
- XmlSerializerFormatAttribute.cs
- BulletedList.cs
- DeclarativeCatalogPart.cs
- Line.cs
- CodeThrowExceptionStatement.cs
- ImmComposition.cs
- Container.cs
- DurationConverter.cs
- RuntimeWrappedException.cs
- CodeAttributeDeclaration.cs
- COM2PropertyPageUITypeConverter.cs
- RestClientProxyHandler.cs
- DoubleAverageAggregationOperator.cs
- RunWorkerCompletedEventArgs.cs
- OnOperation.cs
- XmlElementList.cs
- Transactions.cs
- ReflectionTypeLoadException.cs
- ThemeInfoAttribute.cs
- SelectionEditor.cs
- TransformGroup.cs