Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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. // //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlNavigatorStack.cs
- MarginCollapsingState.cs
- GeneralTransform3DGroup.cs
- CustomWebEventKey.cs
- Vector3DCollection.cs
- ListenerElementsCollection.cs
- SoapFault.cs
- ByeMessage11.cs
- ErrorInfoXmlDocument.cs
- GridProviderWrapper.cs
- TextBox.cs
- PrimitiveXmlSerializers.cs
- DataGridViewCellStyleConverter.cs
- Expr.cs
- oledbmetadatacollectionnames.cs
- ThousandthOfEmRealDoubles.cs
- AngleUtil.cs
- PersonalizationStateInfo.cs
- UnsafePeerToPeerMethods.cs
- Exceptions.cs
- DesignTimeTemplateParser.cs
- PackageDigitalSignature.cs
- UIElementParaClient.cs
- TemplatingOptionsDialog.cs
- RawStylusInputReport.cs
- RemotingAttributes.cs
- FunctionParameter.cs
- FacetValueContainer.cs
- Geometry.cs
- AttributeCollection.cs
- Annotation.cs
- BoolExpressionVisitors.cs
- ValueProviderWrapper.cs
- IdentityModelDictionary.cs
- serverconfig.cs
- CompressEmulationStream.cs
- WebUtil.cs
- TextSegment.cs
- DataTable.cs
- DefaultSettingsSection.cs
- ITreeGenerator.cs
- DifferencingCollection.cs
- AccessDataSourceDesigner.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- AspNetPartialTrustHelpers.cs
- ListBoxItemAutomationPeer.cs
- HtmlControl.cs
- WindowsTreeView.cs
- ProviderSettings.cs
- BackStopAuthenticationModule.cs
- OrderPreservingMergeHelper.cs
- ToolStripArrowRenderEventArgs.cs
- TreeBuilderBamlTranslator.cs
- CqlParser.cs
- JournalEntry.cs
- DecodeHelper.cs
- SchemaMapping.cs
- PasswordTextNavigator.cs
- CharacterMetrics.cs
- PtsPage.cs
- DataSourceUtil.cs
- DispatchWrapper.cs
- CapabilitiesState.cs
- QueryCacheKey.cs
- Tablet.cs
- Section.cs
- OrderedHashRepartitionStream.cs
- BooleanAnimationBase.cs
- ObjectReaderCompiler.cs
- SqlColumnizer.cs
- RectangleConverter.cs
- EvidenceBase.cs
- DocumentViewerBase.cs
- UserPreferenceChangedEventArgs.cs
- initElementDictionary.cs
- Menu.cs
- DeploymentSection.cs
- StoreContentChangedEventArgs.cs
- StringExpressionSet.cs
- PaintEvent.cs
- NativeObjectSecurity.cs
- Image.cs
- DrawingDrawingContext.cs
- BrowserDefinitionCollection.cs
- MenuAutomationPeer.cs
- ContextProperty.cs
- ClientCultureInfo.cs
- AsyncOperationManager.cs
- CLSCompliantAttribute.cs
- TimeSpan.cs
- CodeParameterDeclarationExpression.cs
- JsonWriter.cs
- DataException.cs
- BaseDataListDesigner.cs
- QilInvoke.cs
- HashHelper.cs
- WebCategoryAttribute.cs
- PropertyPushdownHelper.cs
- RawKeyboardInputReport.cs
- TextEditorTables.cs