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
- BuildProvider.cs
- CheckBox.cs
- SecurityContextTokenValidationException.cs
- OpCellTreeNode.cs
- SharedDp.cs
- ControlBuilder.cs
- PageAsyncTaskManager.cs
- IDReferencePropertyAttribute.cs
- AssemblyBuilderData.cs
- DependencyPropertyDescriptor.cs
- SecurityMessageProperty.cs
- MethodMessage.cs
- ZeroOpNode.cs
- HeaderUtility.cs
- ListBoxDesigner.cs
- XmlSchemaChoice.cs
- ShimAsPublicXamlType.cs
- BaseHashHelper.cs
- DbProviderFactories.cs
- PenCursorManager.cs
- CollectionConverter.cs
- WebBrowserUriTypeConverter.cs
- XmlExtensionFunction.cs
- RootBuilder.cs
- XpsPackagingException.cs
- WindowsFormsSectionHandler.cs
- WeakEventTable.cs
- SchemaObjectWriter.cs
- RC2.cs
- CodeNamespaceImport.cs
- SafeLibraryHandle.cs
- ExceptionUtil.cs
- _NestedSingleAsyncResult.cs
- Configuration.cs
- HeaderedContentControl.cs
- OutputCacheProfile.cs
- DataRowCollection.cs
- StandardCommands.cs
- AppliedDeviceFiltersEditor.cs
- AuthorizationSection.cs
- ConfigurationProperty.cs
- PartialCachingControl.cs
- BitmapFrameDecode.cs
- CancelAsyncOperationRequest.cs
- _ListenerAsyncResult.cs
- XhtmlBasicPhoneCallAdapter.cs
- Win32Exception.cs
- ListViewGroupConverter.cs
- RenderContext.cs
- TreeNodeEventArgs.cs
- ViewBase.cs
- SchemaImporterExtension.cs
- PostBackTrigger.cs
- x509utils.cs
- SQLCharsStorage.cs
- SortDescriptionCollection.cs
- OpCodes.cs
- ZipIOModeEnforcingStream.cs
- HostedTcpTransportManager.cs
- TypeInfo.cs
- AsymmetricSignatureFormatter.cs
- PathSegment.cs
- CodeTypeParameterCollection.cs
- ConnectionManagementElement.cs
- HttpCacheVary.cs
- SessionState.cs
- Splitter.cs
- ApplicationFileParser.cs
- MonthCalendar.cs
- WindowsMenu.cs
- Dynamic.cs
- SqlErrorCollection.cs
- AstTree.cs
- HtmlProps.cs
- ProviderConnectionPointCollection.cs
- OdbcReferenceCollection.cs
- TextRangeProviderWrapper.cs
- basevalidator.cs
- Item.cs
- PinnedBufferMemoryStream.cs
- _DomainName.cs
- _TLSstream.cs
- CodeConstructor.cs
- TreeView.cs
- ExtractedStateEntry.cs
- TypefaceMap.cs
- XmlDeclaration.cs
- Axis.cs
- SettingsPropertyWrongTypeException.cs
- UnitySerializationHolder.cs
- PerformanceCounterPermission.cs
- SecurityRuntime.cs
- BinaryMethodMessage.cs
- SecurityUniqueId.cs
- Semaphore.cs
- ListBox.cs
- Utils.cs
- ControlCollection.cs
- RadioButton.cs
- QueryContinueDragEventArgs.cs