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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConditionalBranch.cs
- XmlChildEnumerator.cs
- Point4D.cs
- GZipDecoder.cs
- AppSettingsExpressionBuilder.cs
- LayoutTable.cs
- MethodAccessException.cs
- InstanceNotReadyException.cs
- Point4D.cs
- XamlWriter.cs
- Helpers.cs
- TableLayoutStyleCollection.cs
- ReferenceEqualityComparer.cs
- ValidationError.cs
- CustomErrorsSection.cs
- File.cs
- FileDetails.cs
- CellRelation.cs
- HttpValueCollection.cs
- HelpEvent.cs
- HttpRawResponse.cs
- CodeDirectionExpression.cs
- BuildProvider.cs
- SettingsPropertyNotFoundException.cs
- TextUtf8RawTextWriter.cs
- EntityDataSourceWrapper.cs
- UpdateCommandGenerator.cs
- FixedBufferAttribute.cs
- LayoutSettings.cs
- WeakRefEnumerator.cs
- DataGridItemAttachedStorage.cs
- FileVersionInfo.cs
- Config.cs
- NetworkStream.cs
- InputProcessorProfilesLoader.cs
- ListView.cs
- EditorPartChrome.cs
- EditBehavior.cs
- DependencyObjectProvider.cs
- ApplyTemplatesAction.cs
- SafeCryptoHandles.cs
- ContextQuery.cs
- Connection.cs
- BuildManager.cs
- ResponseStream.cs
- ClientScriptItemCollection.cs
- ChannelOptions.cs
- SqlServices.cs
- EntityParameter.cs
- EncodingNLS.cs
- FormsAuthenticationConfiguration.cs
- XmlWrappingReader.cs
- DBNull.cs
- WinHttpWebProxyFinder.cs
- SizeConverter.cs
- Regex.cs
- SignatureDescription.cs
- PrivateFontCollection.cs
- SymbolEqualComparer.cs
- EntityContainer.cs
- ADMembershipProvider.cs
- TableParagraph.cs
- MultiView.cs
- FormsAuthenticationUserCollection.cs
- CalloutQueueItem.cs
- DrawListViewItemEventArgs.cs
- ConfigurationCollectionAttribute.cs
- RowVisual.cs
- RightNameExpirationInfoPair.cs
- SwitchDesigner.xaml.cs
- ImageCodecInfoPrivate.cs
- CodeSnippetStatement.cs
- Adorner.cs
- StatusBarPanel.cs
- TableRow.cs
- FilterQuery.cs
- ResourceSet.cs
- CompiledQuery.cs
- BindingExpression.cs
- DefinitionBase.cs
- RelatedView.cs
- DataGridViewAccessibleObject.cs
- PropertyGridView.cs
- CompleteWizardStep.cs
- XmlCompatibilityReader.cs
- CompiledQuery.cs
- ActivityWithResultValueSerializer.cs
- UiaCoreApi.cs
- HeaderUtility.cs
- CapabilitiesSection.cs
- CompilerError.cs
- Package.cs
- XmlExpressionDumper.cs
- SimpleHandlerBuildProvider.cs
- PublisherMembershipCondition.cs
- CodeFieldReferenceExpression.cs
- LazyTextWriterCreator.cs
- Graph.cs
- CodeEntryPointMethod.cs
- AppendHelper.cs