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
- MetadataStore.cs
- PrintPreviewDialog.cs
- MenuItemStyleCollectionEditor.cs
- WindowsTreeView.cs
- DtrList.cs
- JavaScriptSerializer.cs
- PersistChildrenAttribute.cs
- SignatureHelper.cs
- DrawToolTipEventArgs.cs
- WindowsFormsHostAutomationPeer.cs
- HwndKeyboardInputProvider.cs
- WSFederationHttpSecurity.cs
- ProjectedWrapper.cs
- TextBoxBaseDesigner.cs
- VirtualPathProvider.cs
- BitmapPalettes.cs
- CustomPeerResolverService.cs
- TextSpanModifier.cs
- CodeExporter.cs
- ContentElement.cs
- CancellationToken.cs
- DataGridRowsPresenter.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- CustomAttributeSerializer.cs
- ToolStripItemTextRenderEventArgs.cs
- HttpContextServiceHost.cs
- TextEncodedRawTextWriter.cs
- ContainerFilterService.cs
- DataTemplateSelector.cs
- MetricEntry.cs
- WeakRefEnumerator.cs
- CrossContextChannel.cs
- MonitoringDescriptionAttribute.cs
- InplaceBitmapMetadataWriter.cs
- ParseElementCollection.cs
- ReverseComparer.cs
- SQLBoolean.cs
- Geometry.cs
- MessageContractAttribute.cs
- FontDialog.cs
- HtmlTableCell.cs
- FlowDocumentScrollViewer.cs
- OleDbConnectionFactory.cs
- X509Utils.cs
- XmlQualifiedName.cs
- Menu.cs
- HijriCalendar.cs
- TextDpi.cs
- ErrorLog.cs
- FontFamily.cs
- Triplet.cs
- Panel.cs
- ContentPathSegment.cs
- SiteMapDataSource.cs
- BindStream.cs
- StringReader.cs
- ContentPlaceHolderDesigner.cs
- MemberExpression.cs
- RowBinding.cs
- SessionMode.cs
- DoubleAnimationClockResource.cs
- SoapEnvelopeProcessingElement.cs
- LinqDataSourceDisposeEventArgs.cs
- ClrProviderManifest.cs
- TCPClient.cs
- DateTimeEditor.cs
- ManagementOptions.cs
- Msec.cs
- NotConverter.cs
- Utils.cs
- MemberExpressionHelper.cs
- MbpInfo.cs
- ListViewUpdatedEventArgs.cs
- FixUpCollection.cs
- EventSetter.cs
- UserPreferenceChangedEventArgs.cs
- HitTestParameters3D.cs
- Pen.cs
- TrackingProvider.cs
- TypeDescriptorContext.cs
- PtsCache.cs
- InheritedPropertyChangedEventArgs.cs
- SourceLineInfo.cs
- SlotInfo.cs
- WebCodeGenerator.cs
- FrameworkReadOnlyPropertyMetadata.cs
- AxisAngleRotation3D.cs
- StoreItemCollection.Loader.cs
- XsdDuration.cs
- CroppedBitmap.cs
- Rotation3D.cs
- XmlBinaryWriter.cs
- ReflectEventDescriptor.cs
- HyperLinkColumn.cs
- XmlElementAttributes.cs
- ErrorItem.cs
- BaseHashHelper.cs
- ConfigXmlCDataSection.cs
- CacheChildrenQuery.cs
- PointCollection.cs