Code:
/ DotNET / DotNET / 8.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
- HelpInfo.cs
- PrimitiveXmlSerializers.cs
- WindowsScrollBar.cs
- SettingsBase.cs
- OleDbTransaction.cs
- ColumnWidthChangingEvent.cs
- CodeEventReferenceExpression.cs
- XamlTreeBuilder.cs
- HandlerWithFactory.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- TextMarkerSource.cs
- BaseTreeIterator.cs
- ExpandoClass.cs
- DSASignatureFormatter.cs
- DataGridLinkButton.cs
- ServiceModelEnumValidator.cs
- MenuItem.cs
- CodeGenerator.cs
- Thread.cs
- Page.cs
- CommonProperties.cs
- FixedMaxHeap.cs
- IIS7UserPrincipal.cs
- BackgroundFormatInfo.cs
- GridEntryCollection.cs
- FlowDocument.cs
- MsmqChannelListenerBase.cs
- UntypedNullExpression.cs
- ListViewItemSelectionChangedEvent.cs
- AccessDataSource.cs
- ExtractorMetadata.cs
- IdentityHolder.cs
- FunctionCommandText.cs
- ConfigurationElement.cs
- DecoratedNameAttribute.cs
- ISAPIRuntime.cs
- PriorityBindingExpression.cs
- TextContainer.cs
- MissingMemberException.cs
- unsafenativemethodsother.cs
- CompletionProxy.cs
- PropagatorResult.cs
- DetailsViewUpdatedEventArgs.cs
- PermissionAttributes.cs
- StructuralType.cs
- DynamicRendererThreadManager.cs
- ObjectDataSourceDisposingEventArgs.cs
- SQLInt16Storage.cs
- PreProcessInputEventArgs.cs
- WindowsFormsLinkLabel.cs
- SweepDirectionValidation.cs
- errorpatternmatcher.cs
- FixedSOMTextRun.cs
- LicenseProviderAttribute.cs
- PropertyMappingExceptionEventArgs.cs
- PeerApplication.cs
- DetailsViewInsertEventArgs.cs
- TextHintingModeValidation.cs
- PropertyConverter.cs
- LateBoundBitmapDecoder.cs
- DbException.cs
- BindingNavigator.cs
- PerformanceCounterPermission.cs
- MediaScriptCommandRoutedEventArgs.cs
- PageEventArgs.cs
- SafeHGlobalHandleCritical.cs
- Compiler.cs
- FormViewPagerRow.cs
- ResizeGrip.cs
- HuffCodec.cs
- MarkupObject.cs
- LambdaCompiler.Expressions.cs
- StrongNameKeyPair.cs
- FilterableAttribute.cs
- RequestUriProcessor.cs
- ListControl.cs
- EntitySqlQueryCacheEntry.cs
- ValidationPropertyAttribute.cs
- Hyperlink.cs
- XmlDictionaryReaderQuotas.cs
- RepeaterItemEventArgs.cs
- XPathSelectionIterator.cs
- DeferredTextReference.cs
- DataSourceControlBuilder.cs
- ResourceDefaultValueAttribute.cs
- Misc.cs
- FieldInfo.cs
- ScriptServiceAttribute.cs
- SoapConverter.cs
- ReceiveActivityDesignerTheme.cs
- GZipDecoder.cs
- VideoDrawing.cs
- WindowPattern.cs
- ToolboxService.cs
- PageThemeParser.cs
- XmlAtomicValue.cs
- Closure.cs
- DrawingBrush.cs
- Message.cs
- MetadataItemEmitter.cs