Пример #1
0
 internal static void SetNETFrameworkCompatiblityMode(AppDomainSetup setup, IRunContext runContext)
 {
     try
     {
         RunConfiguration runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runContext.RunSettings.SettingsXml);
         if (null != runConfiguration && Enum.Equals(runConfiguration.TargetFrameworkVersion, FrameworkVersion.Framework40))
         {
             PropertyInfo pInfo = typeof(AppDomainSetup).GetProperty(Constants.TargetFrameworkName);
             if (null != pInfo)
             {
                 if (EqtTrace.IsVerboseEnabled)
                 {
                     EqtTrace.Verbose("AssemblyHelper.SetNETFrameworkCompatiblityMode: setting .NetFramework,Version=v4.0 compatiblity mode.");
                 }
                 pInfo.SetValue(setup, Constants.DotNetFramework40, null);
             }
             else
             {
                 if (EqtTrace.IsWarningEnabled)
                 {
                     EqtTrace.Warning("AssemblyHelper:SetNETFrameworkCompatiblityMode: Binary compatiblity mode needed, but AppDomainSetup.TargetFrameworkName property not found. Ignoring compatiblity mode.");
                 }
             }
         }
     }
     catch (Exception e)
     {
         if (EqtTrace.IsErrorEnabled)
         {
             EqtTrace.Error("AssemblyHelper:SetNETFrameworkCompatiblityMode:  Caught an exception:{0}", e);
         }
     }
 }
Пример #2
0
 internal static void SetNETFrameworkCompatiblityMode(AppDomainSetup setup, IRunContext runContext)
 {
     try
     {
         RunConfiguration runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runContext.RunSettings.SettingsXml);
         if (null != runConfiguration && (Enum.Equals(runConfiguration.TargetFramework, FrameworkVersion.Framework40) ||
                                          string.Equals(runConfiguration.TargetFramework.ToString(), Constants.DotNetFramework40, StringComparison.OrdinalIgnoreCase)))
         {
             if (EqtTrace.IsVerboseEnabled)
             {
                 EqtTrace.Verbose("AssemblyHelper.SetNETFrameworkCompatiblityMode: setting .NetFramework,Version=v4.0 compatiblity mode.");
             }
             setup.TargetFrameworkName = Constants.DotNetFramework40;
         }
     }
     catch (Exception e)
     {
         if (EqtTrace.IsErrorEnabled)
         {
             EqtTrace.Error("AssemblyHelper:SetNETFrameworkCompatiblityMode:  Caught an exception:{0}", e);
         }
     }
 }