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
- CroppedBitmap.cs
- StringToken.cs
- ColorDialog.cs
- BamlRecordHelper.cs
- ConditionedDesigner.cs
- XamlBrushSerializer.cs
- xml.cs
- dsa.cs
- RequestCacheEntry.cs
- CultureInfo.cs
- PenCursorManager.cs
- RemotingAttributes.cs
- _FtpDataStream.cs
- TreeNode.cs
- ControlCachePolicy.cs
- TeredoHelper.cs
- DbConnectionStringCommon.cs
- RotateTransform.cs
- ClientCultureInfo.cs
- SoapInteropTypes.cs
- VectorCollection.cs
- ValidationSummary.cs
- FontDriver.cs
- GcHandle.cs
- PortCache.cs
- XamlStream.cs
- X509Certificate2Collection.cs
- BinaryCommonClasses.cs
- AssemblyBuilderData.cs
- StylusPointPropertyUnit.cs
- SmtpFailedRecipientException.cs
- ObfuscationAttribute.cs
- OrderedHashRepartitionStream.cs
- DataObjectSettingDataEventArgs.cs
- PropertyDescriptor.cs
- TransformValueSerializer.cs
- DateTimeValueSerializerContext.cs
- IfJoinedCondition.cs
- FilterElement.cs
- DnsEndPoint.cs
- BuildDependencySet.cs
- TextPointer.cs
- ChtmlSelectionListAdapter.cs
- DbInsertCommandTree.cs
- OracleNumber.cs
- AuthenticateEventArgs.cs
- Predicate.cs
- AccessDataSourceView.cs
- IntegerCollectionEditor.cs
- PlanCompiler.cs
- TextFormatterHost.cs
- SpAudioStreamWrapper.cs
- _CookieModule.cs
- WeakReferenceList.cs
- SqlClientMetaDataCollectionNames.cs
- SecureStringHasher.cs
- CreatingCookieEventArgs.cs
- PointAnimation.cs
- CompilerCollection.cs
- GridLength.cs
- BaseProcessor.cs
- DiscoveryViaBehavior.cs
- FixedTextBuilder.cs
- SocketElement.cs
- ICspAsymmetricAlgorithm.cs
- TemplateXamlParser.cs
- DataGridRelationshipRow.cs
- FileVersion.cs
- SimpleTextLine.cs
- InstanceDataCollectionCollection.cs
- PointF.cs
- SmiTypedGetterSetter.cs
- OdbcConnectionHandle.cs
- GeometryValueSerializer.cs
- MimeMapping.cs
- SelectionList.cs
- SqlHelper.cs
- FontCacheUtil.cs
- MouseWheelEventArgs.cs
- QueryableFilterRepeater.cs
- Connector.xaml.cs
- SelectionService.cs
- MenuItemStyleCollection.cs
- SrgsDocument.cs
- PageBuildProvider.cs
- PathNode.cs
- GridErrorDlg.cs
- RIPEMD160.cs
- EtwTrackingParticipant.cs
- nulltextnavigator.cs
- OleDbFactory.cs
- ParamArrayAttribute.cs
- WSHttpSecurityElement.cs
- DefaultPrintController.cs
- InkCanvas.cs
- OlePropertyStructs.cs
- ResourceCollectionInfo.cs
- XmlAnyElementAttributes.cs
- Scene3D.cs
- MemberDomainMap.cs