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
- WebPartRestoreVerb.cs
- Point3DAnimation.cs
- FixedTextContainer.cs
- CurrentChangingEventManager.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- QueuePathDialog.cs
- Odbc32.cs
- ComponentChangingEvent.cs
- SocketException.cs
- Int32CAMarshaler.cs
- GuidConverter.cs
- _NetRes.cs
- RadioButtonList.cs
- ManagementException.cs
- SecurityPermission.cs
- ZoomPercentageConverter.cs
- ReachDocumentReferenceSerializer.cs
- WebException.cs
- HWStack.cs
- BufferedStream.cs
- ZipIOBlockManager.cs
- RSAOAEPKeyExchangeFormatter.cs
- PenCursorManager.cs
- Typography.cs
- SecurityDescriptor.cs
- Line.cs
- WindowsListViewItem.cs
- ObjectDataSourceSelectingEventArgs.cs
- OSFeature.cs
- CodeExpressionRuleDeclaration.cs
- MonthCalendarDesigner.cs
- XmlWriterDelegator.cs
- AuthenticateEventArgs.cs
- KeyValuePairs.cs
- Parser.cs
- COM2ExtendedTypeConverter.cs
- Matrix3DStack.cs
- XmlILModule.cs
- PermissionAttributes.cs
- TextSchema.cs
- SQLByte.cs
- DataBindingHandlerAttribute.cs
- ContentElement.cs
- DataGridCellClipboardEventArgs.cs
- Buffer.cs
- Menu.cs
- SrgsElementFactory.cs
- AssociationEndMember.cs
- SqlAliaser.cs
- DelegateSerializationHolder.cs
- NotSupportedException.cs
- TreeNodeCollection.cs
- EntitySqlQueryCacheEntry.cs
- ClientUriBehavior.cs
- MatrixConverter.cs
- HttpRuntime.cs
- Subtree.cs
- ProcessHostServerConfig.cs
- MetafileHeaderWmf.cs
- Single.cs
- DataGridViewEditingControlShowingEventArgs.cs
- TextFormatter.cs
- InputLanguageEventArgs.cs
- SetterBase.cs
- DocumentCollection.cs
- DropShadowBitmapEffect.cs
- HtmlHistory.cs
- StatusBar.cs
- HTTPRemotingHandler.cs
- DataStorage.cs
- InputChannel.cs
- ObjectConverter.cs
- FaultHandlingFilter.cs
- SqlClientPermission.cs
- XPathNodeHelper.cs
- RadialGradientBrush.cs
- SystemDropShadowChrome.cs
- IPipelineRuntime.cs
- AutoGeneratedField.cs
- IUnknownConstantAttribute.cs
- DataListDesigner.cs
- RbTree.cs
- DbConnectionPool.cs
- BufferedReceiveManager.cs
- WmlPhoneCallAdapter.cs
- PassportAuthenticationModule.cs
- ReferenceConverter.cs
- ListViewItemSelectionChangedEvent.cs
- PolicyUnit.cs
- StructuralObject.cs
- OdbcConnectionPoolProviderInfo.cs
- MappingModelBuildProvider.cs
- Vector3DConverter.cs
- Peer.cs
- safex509handles.cs
- FontFamilyValueSerializer.cs
- MappedMetaModel.cs
- ShortcutKeysEditor.cs
- BindingValueChangedEventArgs.cs
- TextBoxView.cs