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
- SystemWebExtensionsSectionGroup.cs
- Win32.cs
- COM2PropertyBuilderUITypeEditor.cs
- XmlUrlEditor.cs
- ContentControl.cs
- DrawingCollection.cs
- TablePatternIdentifiers.cs
- HashMembershipCondition.cs
- BoolExpression.cs
- AssemblyFilter.cs
- ColumnHeader.cs
- RegexRunnerFactory.cs
- UnsignedPublishLicense.cs
- XmlSchemaFacet.cs
- figurelengthconverter.cs
- DashStyles.cs
- SafeCryptContextHandle.cs
- StateManagedCollection.cs
- CustomValidator.cs
- ConditionCollection.cs
- WindowsListViewItem.cs
- SingleTagSectionHandler.cs
- SatelliteContractVersionAttribute.cs
- MsmqIntegrationMessageProperty.cs
- ResolveNextArgumentWorkItem.cs
- OutputCacheModule.cs
- UserInitiatedNavigationPermission.cs
- SqlTypeSystemProvider.cs
- ContentPlaceHolder.cs
- ConsumerConnectionPoint.cs
- DoubleAnimationClockResource.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- ContentTextAutomationPeer.cs
- ScriptDescriptor.cs
- AutomationElementCollection.cs
- SettingsSection.cs
- ExpressionConverter.cs
- WmpBitmapEncoder.cs
- ArgumentsParser.cs
- TemplatingOptionsDialog.cs
- InfoCardSchemas.cs
- UnSafeCharBuffer.cs
- AppModelKnownContentFactory.cs
- GifBitmapEncoder.cs
- MarkupCompilePass1.cs
- OdbcException.cs
- BlurBitmapEffect.cs
- Library.cs
- _MultipleConnectAsync.cs
- EventSinkHelperWriter.cs
- ViewCellSlot.cs
- ScrollChrome.cs
- XmlTypeAttribute.cs
- RectangleGeometry.cs
- SiteMapDataSourceView.cs
- FlowchartDesigner.xaml.cs
- StructuredTypeInfo.cs
- ObjectViewQueryResultData.cs
- WorkflowApplicationAbortedEventArgs.cs
- InvokePatternIdentifiers.cs
- ProfileGroupSettingsCollection.cs
- EntitySqlQueryCacheEntry.cs
- XmlConvert.cs
- QuotedPrintableStream.cs
- XmlExceptionHelper.cs
- webclient.cs
- InstalledFontCollection.cs
- InternalPermissions.cs
- BaseComponentEditor.cs
- DefaultEventAttribute.cs
- StrokeNodeOperations2.cs
- Model3D.cs
- ColumnHeaderCollectionEditor.cs
- Evaluator.cs
- FixedTextSelectionProcessor.cs
- Point4DConverter.cs
- SynchronizationLockException.cs
- DeclaredTypeValidatorAttribute.cs
- XamlToRtfParser.cs
- WebPartMinimizeVerb.cs
- DelegateHelpers.Generated.cs
- ObjectQueryExecutionPlan.cs
- OutputCacheSettings.cs
- TreeViewImageIndexConverter.cs
- WindowsScrollBarBits.cs
- AuthenticationModuleElementCollection.cs
- MenuEventArgs.cs
- FileLogRecord.cs
- SSmlParser.cs
- FreezableDefaultValueFactory.cs
- DataKey.cs
- _ListenerRequestStream.cs
- UserControlCodeDomTreeGenerator.cs
- XmlWrappingReader.cs
- _ProxyChain.cs
- DecimalFormatter.cs
- CompModSwitches.cs
- PeerNameRegistration.cs
- DeobfuscatingStream.cs
- SchemaImporter.cs