Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / CodeDOM / Compiler / RedistVersionInfo.cs / 1 / RedistVersionInfo.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.CodeDom.Compiler { using System; using System.Diagnostics; using System.IO; using System.CodeDom.Compiler; using System.Configuration; using System.Collections.Generic; using Microsoft.Win32; internal static class RedistVersionInfo { internal const String NameTag = "CompilerVersion"; // name of the tag for specifying the version internal const String DefaultVersion = InPlaceVersion; // should match one of the versions below //internal const String LatestVersion = "Latest"; // always bind to the latest version internal const String InPlaceVersion = "v2.0"; // always bind to Whidbey version internal const String RedistVersion = "v3.5"; // always bind to the Orcas version private const string dotNetFrameworkSdkInstallKeyValueV35 = "MSBuildToolsPath"; private const string dotNetFrameworkRegistryPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\3.5"; public static string GetCompilerPath(IDictionaryprovOptions, string compilerExecutable) { string compPath = Executor.GetRuntimeInstallDirectory(); // if provOptions is provided check to see if it alters what version we should bind to. // provOptions can be null if someone does new VB/CSCodeProvider(), in which case // they get the Whidbey behavior. if (provOptions != null) { string versionVal;//, newPath; if (provOptions.TryGetValue(RedistVersionInfo.NameTag, out versionVal)) { switch (versionVal) { //case RedistVersionInfo.LatestVersion: // always run against the latest version of the compiler // newPath = GetOrcasPath(); // if (newPath != null && File.Exists(Path.Combine(newPath, compilerExecutable))) // compPath = newPath; // break; case RedistVersionInfo.RedistVersion: // lock-forward to the Orcas version, if it's not available throw (we'll throw at compile time) compPath = GetOrcasPath(); break; case RedistVersionInfo.InPlaceVersion: // lock-back to the Whidbey version, no-op break; default: compPath = null; break; } } } if (compPath == null) throw new InvalidOperationException(SR.GetString(SR.CompilerNotFound, compilerExecutable)); return compPath; } /// /// this method returns the location of the Orcas compilers, but will return whatever /// version is requested via the COMPlus_ environment variables first /// private static string GetOrcasPath() { string dir = null; // if this is running in a private running environment such as Razzle, we would use the path // based on the environment variables: COMPLUS_InstallRoot and COMPLUS_Version. string comPlus_InstallRoot = Environment.GetEnvironmentVariable("COMPLUS_InstallRoot"); string comPlus_Version = Environment.GetEnvironmentVariable("COMPLUS_Version"); if (!string.IsNullOrEmpty(comPlus_InstallRoot) && !string.IsNullOrEmpty(comPlus_Version)) { dir = Path.Combine(comPlus_InstallRoot, comPlus_Version); if (Directory.Exists(dir)) return dir; } dir = Registry.GetValue(dotNetFrameworkRegistryPath, dotNetFrameworkSdkInstallKeyValueV35, null) as string; if (dir != null && Directory.Exists(dir)) { return dir; } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.CodeDom.Compiler { using System; using System.Diagnostics; using System.IO; using System.CodeDom.Compiler; using System.Configuration; using System.Collections.Generic; using Microsoft.Win32; internal static class RedistVersionInfo { internal const String NameTag = "CompilerVersion"; // name of the tag for specifying the version internal const String DefaultVersion = InPlaceVersion; // should match one of the versions below //internal const String LatestVersion = "Latest"; // always bind to the latest version internal const String InPlaceVersion = "v2.0"; // always bind to Whidbey version internal const String RedistVersion = "v3.5"; // always bind to the Orcas version private const string dotNetFrameworkSdkInstallKeyValueV35 = "MSBuildToolsPath"; private const string dotNetFrameworkRegistryPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\3.5"; public static string GetCompilerPath(IDictionaryprovOptions, string compilerExecutable) { string compPath = Executor.GetRuntimeInstallDirectory(); // if provOptions is provided check to see if it alters what version we should bind to. // provOptions can be null if someone does new VB/CSCodeProvider(), in which case // they get the Whidbey behavior. if (provOptions != null) { string versionVal;//, newPath; if (provOptions.TryGetValue(RedistVersionInfo.NameTag, out versionVal)) { switch (versionVal) { //case RedistVersionInfo.LatestVersion: // always run against the latest version of the compiler // newPath = GetOrcasPath(); // if (newPath != null && File.Exists(Path.Combine(newPath, compilerExecutable))) // compPath = newPath; // break; case RedistVersionInfo.RedistVersion: // lock-forward to the Orcas version, if it's not available throw (we'll throw at compile time) compPath = GetOrcasPath(); break; case RedistVersionInfo.InPlaceVersion: // lock-back to the Whidbey version, no-op break; default: compPath = null; break; } } } if (compPath == null) throw new InvalidOperationException(SR.GetString(SR.CompilerNotFound, compilerExecutable)); return compPath; } /// /// this method returns the location of the Orcas compilers, but will return whatever /// version is requested via the COMPlus_ environment variables first /// private static string GetOrcasPath() { string dir = null; // if this is running in a private running environment such as Razzle, we would use the path // based on the environment variables: COMPLUS_InstallRoot and COMPLUS_Version. string comPlus_InstallRoot = Environment.GetEnvironmentVariable("COMPLUS_InstallRoot"); string comPlus_Version = Environment.GetEnvironmentVariable("COMPLUS_Version"); if (!string.IsNullOrEmpty(comPlus_InstallRoot) && !string.IsNullOrEmpty(comPlus_Version)) { dir = Path.Combine(comPlus_InstallRoot, comPlus_Version); if (Directory.Exists(dir)) return dir; } dir = Registry.GetValue(dotNetFrameworkRegistryPath, dotNetFrameworkSdkInstallKeyValueV35, null) as string; if (dir != null && Directory.Exists(dir)) { return dir; } return null; } } } // 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
- XmlDataSource.cs
- WebFormsRootDesigner.cs
- DockPanel.cs
- ScrollBarAutomationPeer.cs
- TextSelectionHelper.cs
- XPathDocumentNavigator.cs
- AutoGeneratedFieldProperties.cs
- TreeNodeClickEventArgs.cs
- PhonemeEventArgs.cs
- TdsValueSetter.cs
- OdbcCommand.cs
- PriorityBinding.cs
- Visual3D.cs
- DoWorkEventArgs.cs
- WindowClosedEventArgs.cs
- TraceHwndHost.cs
- MergeFailedEvent.cs
- Focus.cs
- FormViewAutoFormat.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- ConstraintConverter.cs
- NullEntityWrapper.cs
- WebScriptClientGenerator.cs
- SymLanguageType.cs
- PageCache.cs
- diagnosticsswitches.cs
- TableStyle.cs
- FixedSOMTextRun.cs
- CachedFontFace.cs
- Point.cs
- XmlElement.cs
- RuntimeEnvironment.cs
- ConfigurationPropertyAttribute.cs
- Wildcard.cs
- WsdlInspector.cs
- ComponentCollection.cs
- UnauthorizedWebPart.cs
- WebBrowserPermission.cs
- TopClause.cs
- DataSourceHelper.cs
- UmAlQuraCalendar.cs
- EntityContainer.cs
- EntityViewContainer.cs
- AspProxy.cs
- InputLanguageSource.cs
- InstanceCreationEditor.cs
- DeleteHelper.cs
- WebPartDescriptionCollection.cs
- ConfigurationSection.cs
- CatchDesigner.xaml.cs
- HttpGetProtocolReflector.cs
- TreeNodeClickEventArgs.cs
- basevalidator.cs
- NullableIntMinMaxAggregationOperator.cs
- GridViewDesigner.cs
- TableLayoutRowStyleCollection.cs
- FunctionNode.cs
- PersonalizationStateInfo.cs
- DataGridLengthConverter.cs
- LassoHelper.cs
- DesignerDataConnection.cs
- ContainerCodeDomSerializer.cs
- TextEffectCollection.cs
- TransactionFilter.cs
- SoapReflectionImporter.cs
- SocketPermission.cs
- TypeToken.cs
- DynamicControl.cs
- ObjectQuery_EntitySqlExtensions.cs
- BufferModesCollection.cs
- XmlProcessingInstruction.cs
- PEFileEvidenceFactory.cs
- TypedAsyncResult.cs
- AccessText.cs
- EdmProperty.cs
- PassportPrincipal.cs
- SmtpAuthenticationManager.cs
- SessionEndingCancelEventArgs.cs
- ComboBox.cs
- BitmapEffectDrawingContent.cs
- keycontainerpermission.cs
- DocumentsTrace.cs
- TypeElement.cs
- HwndSubclass.cs
- dbenumerator.cs
- AutoScrollExpandMessageFilter.cs
- WindowsToolbarAsMenu.cs
- ParameterToken.cs
- GridPattern.cs
- User.cs
- DataChangedEventManager.cs
- ProcessThread.cs
- MenuItemBinding.cs
- FixedDocumentSequencePaginator.cs
- OleDbSchemaGuid.cs
- BitmapInitialize.cs
- ToolbarAUtomationPeer.cs
- StorageEntityTypeMapping.cs
- TextParaClient.cs
- FigureParagraph.cs