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
- ViewService.cs
- SerialReceived.cs
- DesignerSerializationManager.cs
- FixedLineResult.cs
- EventDescriptor.cs
- BaseDataBoundControl.cs
- ApplyTemplatesAction.cs
- MarkupCompilePass1.cs
- CompilerTypeWithParams.cs
- CodeTypeReferenceExpression.cs
- ProxyWebPartConnectionCollection.cs
- StorageEntityTypeMapping.cs
- ScriptingJsonSerializationSection.cs
- sqlstateclientmanager.cs
- FileSecurity.cs
- FormViewCommandEventArgs.cs
- NeutralResourcesLanguageAttribute.cs
- EditingContext.cs
- FolderLevelBuildProvider.cs
- XmlSigningNodeWriter.cs
- XomlDesignerLoader.cs
- ObjectNotFoundException.cs
- FastEncoderWindow.cs
- SHA256Managed.cs
- DispatcherHooks.cs
- TextRangeBase.cs
- ResXResourceReader.cs
- WebPartConnectionsCancelEventArgs.cs
- WebServiceAttribute.cs
- IdentifierService.cs
- parserscommon.cs
- ListDesigner.cs
- EntityDataSourceState.cs
- PublisherIdentityPermission.cs
- TableProviderWrapper.cs
- AssemblyCollection.cs
- OneToOneMappingSerializer.cs
- StandardBindingElementCollection.cs
- AdvancedBindingPropertyDescriptor.cs
- ExtendedProtectionPolicyTypeConverter.cs
- ProgressPage.cs
- COM2ICategorizePropertiesHandler.cs
- EntityDataSourceWrapperCollection.cs
- MediaElementAutomationPeer.cs
- MouseActionConverter.cs
- DocumentPageTextView.cs
- GlyphsSerializer.cs
- Size.cs
- InkCanvasFeedbackAdorner.cs
- Opcode.cs
- DropShadowEffect.cs
- TextDecoration.cs
- LinkClickEvent.cs
- ZoneIdentityPermission.cs
- MemberDescriptor.cs
- Path.cs
- JsonObjectDataContract.cs
- DiscoveryVersionConverter.cs
- RegionData.cs
- AutomationAttributeInfo.cs
- ProfileService.cs
- PolyBezierSegment.cs
- WeakEventManager.cs
- newinstructionaction.cs
- PropertyChangeTracker.cs
- OpenTypeCommon.cs
- ValidationPropertyAttribute.cs
- TraceInternal.cs
- GlobalProxySelection.cs
- AccessDataSourceDesigner.cs
- SelectionEditingBehavior.cs
- ContentTextAutomationPeer.cs
- Control.cs
- RijndaelManagedTransform.cs
- CqlQuery.cs
- PLINQETWProvider.cs
- PKCS1MaskGenerationMethod.cs
- KeyedCollection.cs
- EntityDesignerUtils.cs
- XsltLoader.cs
- UseManagedPresentationBindingElementImporter.cs
- ResourceCodeDomSerializer.cs
- PrimaryKeyTypeConverter.cs
- SafeReversePInvokeHandle.cs
- BasePattern.cs
- PolyLineSegment.cs
- InputLanguageCollection.cs
- CSharpCodeProvider.cs
- XmlNodeReader.cs
- PropertyItem.cs
- ResourcesBuildProvider.cs
- SystemMulticastIPAddressInformation.cs
- Listbox.cs
- OracleConnectionStringBuilder.cs
- DesignerDataView.cs
- AssemblyFilter.cs
- ToolStripRenderEventArgs.cs
- TdsValueSetter.cs
- IncomingWebResponseContext.cs
- TransactionScope.cs