Code:
/ FX-1434 / FX-1434 / 1.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
- ThrowHelper.cs
- AnonymousIdentificationSection.cs
- PageAdapter.cs
- XPathArrayIterator.cs
- Decimal.cs
- BackgroundFormatInfo.cs
- View.cs
- oledbconnectionstring.cs
- UserControlCodeDomTreeGenerator.cs
- WhiteSpaceTrimStringConverter.cs
- Underline.cs
- ProxyHelper.cs
- SqlMethodTransformer.cs
- ThreadExceptionDialog.cs
- XmlReaderSettings.cs
- DataSysAttribute.cs
- TreeNodeCollection.cs
- HtmlInputText.cs
- SqlProvider.cs
- PreservationFileReader.cs
- __ComObject.cs
- isolationinterop.cs
- XmlNode.cs
- BasicViewGenerator.cs
- InternalDispatchObject.cs
- XmlSchemaAttributeGroup.cs
- SessionIDManager.cs
- ObjectConverter.cs
- FunctionParameter.cs
- StringSource.cs
- SingleAnimationBase.cs
- ResourcePool.cs
- OleDbParameter.cs
- Timer.cs
- CmsInterop.cs
- ClickablePoint.cs
- activationcontext.cs
- TextTreePropertyUndoUnit.cs
- LookupBindingPropertiesAttribute.cs
- FileDetails.cs
- TypeUsage.cs
- DataViewSettingCollection.cs
- _ProxyChain.cs
- AuthenticationConfig.cs
- RelatedImageListAttribute.cs
- Menu.cs
- ActivityDesigner.cs
- CodeValidator.cs
- SimpleTextLine.cs
- ToolBar.cs
- CheckBoxRenderer.cs
- BlurEffect.cs
- DataBindingHandlerAttribute.cs
- HandlerBase.cs
- WriteTimeStream.cs
- SiteOfOriginPart.cs
- ConsoleTraceListener.cs
- PropertyGridView.cs
- Int32RectConverter.cs
- HtmlTableRowCollection.cs
- DbException.cs
- FixedNode.cs
- VirtualDirectoryMappingCollection.cs
- SafeEventHandle.cs
- TextEditorDragDrop.cs
- DebuggerService.cs
- TextRange.cs
- SmtpTransport.cs
- WebSysDisplayNameAttribute.cs
- CaseInsensitiveComparer.cs
- PageParserFilter.cs
- DataGridItemEventArgs.cs
- TextDecorationCollection.cs
- BitmapEffectRenderDataResource.cs
- XmlBinaryReader.cs
- FontCacheLogic.cs
- CqlGenerator.cs
- ImageMapEventArgs.cs
- CompositionTarget.cs
- ButtonBaseAdapter.cs
- Double.cs
- DataGridViewImageColumn.cs
- XmlExtensionFunction.cs
- ToolStripCollectionEditor.cs
- WebPartDisplayMode.cs
- AstTree.cs
- WebPartMenu.cs
- DoubleAnimationClockResource.cs
- TextSelectionHighlightLayer.cs
- ComplexObject.cs
- ExcludeFromCodeCoverageAttribute.cs
- PerformanceCounter.cs
- UserNamePasswordValidationMode.cs
- EntityDataSourceValidationException.cs
- XmlAutoDetectWriter.cs
- EventLogReader.cs
- Mapping.cs
- DataGridViewCellCancelEventArgs.cs
- ParentUndoUnit.cs
- PrinterSettings.cs