/// <summary> /// Set configuration properties for a specific configuration /// </summary> /// <param name="config">configuration name</param> protected virtual void SetBuildConfigurationProperties(string config) { ProjectOptions options = null; if (!String.IsNullOrEmpty(config)) { options = this.GetProjectOptions(config); } if (options != null && this.buildProject != null) { // Make sure the project configuration is set properly this.SetConfiguration(config); } }
public virtual void OnTargetFrameworkMonikerChanged(ProjectOptions options, FrameworkName currentTargetFramework, FrameworkName newTargetFramework) { if (currentTargetFramework == null) { throw new ArgumentNullException("currentTargetFramework"); } if (newTargetFramework == null) { throw new ArgumentNullException("newTargetFramework"); } var retargetingService = this.site.GetService(typeof(SVsTrackProjectRetargeting)) as IVsTrackProjectRetargeting; if (retargetingService == null) { // Probably in a unit test. ////throw new InvalidOperationException("Unable to acquire the SVsTrackProjectRetargeting service."); Marshal.ThrowExceptionForHR(UpdateTargetFramework(this, currentTargetFramework.FullName, newTargetFramework.FullName)); } else { Marshal.ThrowExceptionForHR(retargetingService.OnSetTargetFramework(this, currentTargetFramework.FullName, newTargetFramework.FullName, this, true)); } }
/// <summary> /// Set the configuration property in MSBuild. /// This does not get persisted and is used to evaluate msbuild conditions /// which are based on the $(Configuration) property. /// </summary> /// <param name="config">Configuration name</param> protected internal virtual void SetConfiguration(string config) { if (config == null) { throw new ArgumentNullException("config"); } // Can't ask for the active config until the project is opened, so do nothing in that scenario if (!projectOpened) return; // We cannot change properties during the build so if the config // we want to se is the current, we do nothing otherwise we fail. if (this.BuildInProgress) { EnvDTE.Project automationObject = this.GetAutomationObject() as EnvDTE.Project; string currentConfigName = Utilities.GetActiveConfigurationName(automationObject); bool configsAreEqual = String.Compare(currentConfigName, config, StringComparison.OrdinalIgnoreCase) == 0; if (configsAreEqual) { return; } throw new InvalidOperationException(); } bool propertiesChanged = this.buildProject.SetGlobalProperty(ProjectFileConstants.Configuration, config); if (this.currentConfig == null || propertiesChanged) { this.currentConfig = this.buildProject.CreateProjectInstance(); } if (propertiesChanged || this.designTimeAssemblyResolution == null) { if (this.designTimeAssemblyResolution == null) { this.designTimeAssemblyResolution = new DesignTimeAssemblyResolution(); } this.designTimeAssemblyResolution.Initialize(this); } this.options = null; }
public virtual void SetTargetPlatform(ProjectOptions options) { }
public virtual ProjectOptions GetProjectOptions(string config = null) { if (string.IsNullOrEmpty(config)) { EnvDTE.Project automationObject = this.GetAutomationObject() as EnvDTE.Project; try { config = Utilities.GetActiveConfigurationName(automationObject); } catch (InvalidOperationException) { // Can't figure out the active configuration. Perhaps during solution load, or in a unit test. } catch (COMException) { // We may be in solution load and don't have an active config yet. } } if (this.options != null && String.Equals(this.options.Config, config, StringComparison.OrdinalIgnoreCase)) return this.options; ProjectOptions options = CreateProjectOptions(); options.Config = config; string targetFrameworkMoniker = GetProjectProperty("TargetFrameworkMoniker", false); if (!string.IsNullOrEmpty(targetFrameworkMoniker)) { try { options.TargetFrameworkMoniker = new FrameworkName(targetFrameworkMoniker); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } } if (config == null) { this.options = options; return options; } options.GenerateExecutable = true; this.SetConfiguration(config); string outputPath = this.GetOutputPath(this.currentConfig); if (!String.IsNullOrEmpty(outputPath)) { // absolutize relative to project folder location outputPath = Path.Combine(this.ProjectFolder, outputPath); } // Set some default values options.OutputAssembly = outputPath + this.Caption + ".exe"; options.ModuleKind = ModuleKindFlags.ConsoleApplication; options.RootNamespace = GetProjectProperty(ProjectFileConstants.RootNamespace, false); options.OutputAssembly = outputPath + this.GetAssemblyName(config); string outputtype = GetProjectProperty(ProjectFileConstants.OutputType, false); if (!string.IsNullOrEmpty(outputtype)) { outputtype = outputtype.ToLower(CultureInfo.InvariantCulture); } if (outputtype == "library") { options.ModuleKind = ModuleKindFlags.DynamicallyLinkedLibrary; options.GenerateExecutable = false; // DLL's have no entry point. } else if (outputtype == "winexe") options.ModuleKind = ModuleKindFlags.WindowsApplication; else options.ModuleKind = ModuleKindFlags.ConsoleApplication; options.Win32Icon = GetProjectProperty("ApplicationIcon", false); options.MainClass = GetProjectProperty("StartupObject", false); // other settings from CSharp we may want to adopt at some point... // AssemblyKeyContainerName = "" //This is the key file used to sign the interop assembly generated when importing a com object via add reference // AssemblyOriginatorKeyFile = "" // DelaySign = "false" // DefaultClientScript = "JScript" // DefaultHTMLPageLayout = "Grid" // DefaultTargetSchema = "IE50" // PreBuildEvent = "" // PostBuildEvent = "" // RunPostBuildEvent = "OnBuildSuccess" // transfer all config build options... if (GetBoolAttr(this.currentConfig, "AllowUnsafeBlocks")) { options.AllowUnsafeCode = true; } if (GetProjectProperty("BaseAddress", false) != null) { try { options.BaseAddress = Int64.Parse(GetProjectProperty("BaseAddress", false), CultureInfo.InvariantCulture); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } if (GetBoolAttr(this.currentConfig, "CheckForOverflowUnderflow")) { options.CheckedArithmetic = true; } if (GetProjectProperty("DefineConstants", false) != null) { options.DefinedPreprocessorSymbols = new StringCollection(); foreach (string s in GetProjectProperty("DefineConstants", false).Replace(" \t\r\n", "").Split(';')) { options.DefinedPreprocessorSymbols.Add(s); } } string docFile = GetProjectProperty("DocumentationFile", false); if (!String.IsNullOrEmpty(docFile)) { options.XmlDocFileName = Path.Combine(this.ProjectFolder, docFile); } if (GetBoolAttr(this.currentConfig, "DebugSymbols")) { options.IncludeDebugInformation = true; } if (GetProjectProperty("FileAlignment", false) != null) { try { options.FileAlignment = Int32.Parse(GetProjectProperty("FileAlignment", false), CultureInfo.InvariantCulture); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } if (GetBoolAttr(this.currentConfig, "IncrementalBuild")) { options.IncrementalCompile = true; } if (GetBoolAttr(this.currentConfig, "Optimize")) { options.Optimize = true; } if (GetBoolAttr(this.currentConfig, "RegisterForComInterop")) { } if (GetBoolAttr(this.currentConfig, "RemoveIntegerChecks")) { } if (GetBoolAttr(this.currentConfig, "TreatWarningsAsErrors")) { options.TreatWarningsAsErrors = true; } if (GetProjectProperty("WarningLevel", false) != null) { try { options.WarningLevel = Int32.Parse(GetProjectProperty("WarningLevel", false), CultureInfo.InvariantCulture); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } this.options = options; // do this AFTER setting configuration so it doesn't clear it. return options; }
/// <summary> /// Set dirty state of project /// </summary> /// <param name="value">boolean value indicating dirty state</param> public void SetProjectFileDirty(bool value) { this.options = null; this.isDirty = value; if(this.isDirty) { this.lastModifiedTime = DateTime.Now; this.buildIsPrepared = false; } }
public virtual ProjectOptions GetProjectOptions(string config) { bool configNotChanged = String.Compare( currentConfig[ProjectFileConstants.Configuration].Value, config, StringComparison.OrdinalIgnoreCase) == 0; if (this.options != null && configNotChanged) return this.options; ProjectOptions options = this.options = CreateProjectOptions(); if(config == null) return options; options.GenerateExecutable = true; this.SetConfiguration(config); string outputPath = this.GetOutputPath(this.currentConfig); if(!String.IsNullOrEmpty(outputPath)) { // absolutize relative to project folder location outputPath = Path.Combine(this.ProjectFolder, outputPath); } // Set some default values options.OutputAssembly = outputPath + this.Caption + ".exe"; options.ModuleKind = ModuleKindFlags.ConsoleApplication; options.RootNamespace = GetProjectProperty(ProjectFileConstants.RootNamespace, false); options.OutputAssembly = outputPath + this.GetAssemblyName(config); string outputtype = GetProjectProperty(ProjectFileConstants.OutputType, false); if(!string.IsNullOrEmpty(outputtype)) { outputtype = outputtype.ToLower(CultureInfo.InvariantCulture); } if(outputtype == "library") { options.ModuleKind = ModuleKindFlags.DynamicallyLinkedLibrary; options.GenerateExecutable = false; // DLL's have no entry point. } else if(outputtype == "winexe") options.ModuleKind = ModuleKindFlags.WindowsApplication; else options.ModuleKind = ModuleKindFlags.ConsoleApplication; options.Win32Icon = GetProjectProperty("ApplicationIcon", false); options.MainClass = GetProjectProperty("StartupObject", false); string targetPlatform = GetProjectProperty("TargetPlatform", false); if(targetPlatform != null && targetPlatform.Length > 0) { try { options.TargetPlatform = (PlatformType)Enum.Parse(typeof(PlatformType), targetPlatform); } catch(ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } options.TargetPlatformLocation = GetProjectProperty("TargetPlatformLocation", false); this.SetTargetPlatform(options); } // other settings from CSharp we may want to adopt at some point... // AssemblyKeyContainerName = "" //This is the key file used to sign the interop assembly generated when importing a com object via add reference // AssemblyOriginatorKeyFile = "" // DelaySign = "false" // DefaultClientScript = "JScript" // DefaultHTMLPageLayout = "Grid" // DefaultTargetSchema = "IE50" // PreBuildEvent = "" // PostBuildEvent = "" // RunPostBuildEvent = "OnBuildSuccess" // transfer all config build options... if(GetBoolAttr(this.currentConfig, "AllowUnsafeBlocks")) { options.AllowUnsafeCode = true; } if(GetProjectProperty("BaseAddress", false) != null) { try { options.BaseAddress = Int64.Parse(GetProjectProperty("BaseAddress", false), CultureInfo.InvariantCulture); } catch(ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch(ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch(FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch(OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } if(GetBoolAttr(this.currentConfig, "CheckForOverflowUnderflow")) { options.CheckedArithmetic = true; } if(GetProjectProperty("DefineConstants", false) != null) { options.DefinedPreprocessorSymbols = new StringCollection(); foreach(string s in GetProjectProperty("DefineConstants", false).Replace(" \t\r\n", "").Split(';')) { options.DefinedPreprocessorSymbols.Add(s); } } string docFile = GetProjectProperty("DocumentationFile", false); if(!String.IsNullOrEmpty(docFile)) { options.XmlDocFileName = Path.Combine(this.ProjectFolder, docFile); } if(GetBoolAttr(this.currentConfig, "DebugSymbols")) { options.IncludeDebugInformation = true; } if(GetProjectProperty("FileAlignment", false) != null) { try { options.FileAlignment = Int32.Parse(GetProjectProperty("FileAlignment", false), CultureInfo.InvariantCulture); } catch(ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch(ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch(FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch(OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } if(GetBoolAttr(this.currentConfig, "IncrementalBuild")) { options.IncrementalCompile = true; } if(GetBoolAttr(this.currentConfig, "Optimize")) { options.Optimize = true; } if(GetBoolAttr(this.currentConfig, "RegisterForComInterop")) { } if(GetBoolAttr(this.currentConfig, "RemoveIntegerChecks")) { } if(GetBoolAttr(this.currentConfig, "TreatWarningsAsErrors")) { options.TreatWarningsAsErrors = true; } if(GetProjectProperty("WarningLevel", false) != null) { try { options.WarningLevel = Int32.Parse(GetProjectProperty("WarningLevel", false), CultureInfo.InvariantCulture); } catch(ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch(ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch(FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch(OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } return options; }
/// <summary> /// Set the configuration property in MSBuild. /// This does not get persisted and is used to evaluate msbuild conditions /// which are based on the $(Configuration) property. /// </summary> /// <param name="configKey">Configuration name</param> protected internal virtual void SetConfiguration(string configKey) { if (configKey == null) throw new ArgumentNullException("configKey"); // Can't ask for the active config until the project is opened, so do nothing in that scenario if (!projectOpened) return; // We cannot change properties during the build so if the config // we want to se is the current, we do nothing otherwise we fail. if (this.BuildInProgress) { var currentConfigKey = ProjectConfig.TryGetActiveConfigurationAndPlatform(ServiceProvider, this); if (ProjectConfig.Eq(currentConfigKey, configKey)) return; throw new InvalidOperationException("Can't set other configuration during a build in progress."); } string configName; string platformName; if (!ProjectConfig.TrySplitConfigurationCanonicalName(configKey, out configName, out platformName)) configName = configKey; bool propertiesChanged = this.buildProject.SetGlobalProperty(ProjectFileConstants.Configuration, configName); if (!string.IsNullOrWhiteSpace(platformName)) propertiesChanged |= this.buildProject.SetGlobalProperty(ProjectFileConstants.Platform, ProjectConfig.ToMSBuildPlatform(platformName)); //this.buildProject.ReevaluateIfNecessary(); //??? if (this.currentConfig == null || propertiesChanged) this.currentConfig = this.buildProject.CreateProjectInstance(); if (propertiesChanged || this.designTimeAssemblyResolution == null) { if (this.designTimeAssemblyResolution == null) this.designTimeAssemblyResolution = new DesignTimeAssemblyResolution(); this.designTimeAssemblyResolution.Initialize(this); } this.options = null; }
/// <summary> /// Set the configuration property in MSBuild. /// This does not get persisted and is used to evaluate msbuild conditions /// which are based on the $(Configuration) property. /// </summary> /// <param name="config">Configuration name</param> public virtual void SetConfiguration(string config, string platform) { if (config == null) throw new ArgumentNullException("config"); if (platform == null) throw new ArgumentNullException("platform"); // Can't ask for the active config until the project is opened, so do nothing in that scenario if (!projectOpened) return; // We cannot change properties during the build so if the config // we want to set is the current, we do nothing otherwise we fail. if (this.BuildInProgress) { EnvDTE.Project automationObject = this.GetAutomationObject() as EnvDTE.Project; string currentConfigName = Utilities.GetActiveConfigurationName(automationObject); string currentPlatformName = Utilities.GetActivePlatformName(automationObject); bool configsAreEqual = string.Equals(currentConfigName, config, StringComparison.OrdinalIgnoreCase) && string.Equals(currentPlatformName, platform, StringComparison.OrdinalIgnoreCase); if (configsAreEqual) { return; } throw new InvalidOperationException("Cannot change configurations during a build."); } bool propertiesChanged = this.buildProject.SetGlobalProperty(ProjectFileConstants.Configuration, config); propertiesChanged |= this.buildProject.SetGlobalProperty(ProjectFileConstants.Platform, ConfigProvider.GetPlatformPropertyFromPlatformName(platform)); var userBuildProject = UserBuildProject; if (userBuildProject != null) { propertiesChanged |= userBuildProject.SetGlobalProperty(ProjectFileConstants.Configuration, config); propertiesChanged |= userBuildProject.SetGlobalProperty(ProjectFileConstants.Platform, ConfigProvider.GetPlatformPropertyFromPlatformName(platform)); } if (this.currentConfig == null || propertiesChanged) { this.currentConfig = this.buildProject.CreateProjectInstance(); } if (propertiesChanged || (this.designTimeAssemblyResolution == null && !this.designTimeAssemblyResolutionFailed)) { this.designTimeAssemblyResolutionFailed = false; if (this.designTimeAssemblyResolution == null) { this.designTimeAssemblyResolution = new DesignTimeAssemblyResolution(); } try { this.designTimeAssemblyResolution.Initialize(this); } catch (InvalidOperationException) { this.designTimeAssemblyResolution = null; this.designTimeAssemblyResolutionFailed = true; } } this._options = null; }
public virtual ProjectOptions GetProjectOptions(string config, string platform) { if ((!string.IsNullOrEmpty(config) && string.IsNullOrEmpty(platform)) || (string.IsNullOrEmpty(config) && !string.IsNullOrEmpty(platform))) { throw new ArgumentException("Either both or neither the configuration and platform should be specified."); } if (string.IsNullOrEmpty(config)) { EnvDTE.Project automationObject = this.GetAutomationObject() as EnvDTE.Project; try { config = Utilities.GetActiveConfigurationName(automationObject); platform = Utilities.GetActivePlatformName(automationObject); } catch (InvalidOperationException) { // Can't figure out the active configuration. Perhaps during solution load, or in a unit test. } catch (COMException) { // We may be in solution load and don't have an active config yet. } } // Even though the options are the same, when this config was originally set, it may have been before // the project system was ready to set up its configuration, so go ahead and call through to SetConfiguration // anyway -- it should do effectively nothing if the config is the same and all the initialization has // already occurred. if (this._options != null && string.Equals(this._options.Config, config, StringComparison.OrdinalIgnoreCase) && string.Equals(this._options.Platform, platform, StringComparison.OrdinalIgnoreCase)) { if (config != null && platform != null) { // Fancy dance with the options required because SetConfiguration nulls out this.options // even if the configuration itself has not changed; whereas we're only calling SetConfiguration // for purposes of initializing some other fields here; since we know the config is the same, it // should be perfectly safe to keep the same options as before. ProjectOptions currentOptions = this._options; this.SetConfiguration(config, platform); this._options = currentOptions; } return this._options; } ProjectOptions options = CreateProjectOptions(); options.Config = config; options.Platform = platform; string targetFrameworkMoniker = GetProjectProperty("TargetFrameworkMoniker", _PersistStorageType.PST_PROJECT_FILE, false); if (!string.IsNullOrEmpty(targetFrameworkMoniker)) { try { options.TargetFrameworkMoniker = new FrameworkName(targetFrameworkMoniker); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } } if (config == null) { this._options = options; return options; } options.GenerateExecutable = true; this.SetConfiguration(config, platform); string outputPath = GetOutputPath(this.currentConfig); if (!String.IsNullOrEmpty(outputPath)) { // absolutize relative to project folder location outputPath = Path.Combine(this.ProjectFolder, outputPath); } // Set some default values options.OutputAssembly = outputPath + this.Caption + ".exe"; options.ModuleKind = ModuleKind.ConsoleApplication; options.RootNamespace = GetProjectProperty(ProjectFileConstants.RootNamespace, _PersistStorageType.PST_PROJECT_FILE, false); options.OutputAssembly = outputPath + this.GetAssemblyName(config, platform); string outputtype = GetProjectProperty(ProjectFileConstants.OutputType, _PersistStorageType.PST_PROJECT_FILE, false); if (!string.IsNullOrEmpty(outputtype)) { outputtype = outputtype.ToLower(CultureInfo.InvariantCulture); } if (outputtype == "library") { options.ModuleKind = ModuleKind.DynamicallyLinkedLibrary; options.GenerateExecutable = false; // DLL's have no entry point. } else if (outputtype == "winexe") options.ModuleKind = ModuleKind.WindowsApplication; else options.ModuleKind = ModuleKind.ConsoleApplication; options.Win32Icon = GetProjectProperty("ApplicationIcon", _PersistStorageType.PST_PROJECT_FILE, false); options.MainClass = GetProjectProperty("StartupObject", _PersistStorageType.PST_PROJECT_FILE, false); // other settings from CSharp we may want to adopt at some point... // AssemblyKeyContainerName = "" //This is the key file used to sign the interop assembly generated when importing a com object via add reference // AssemblyOriginatorKeyFile = "" // DelaySign = "false" // DefaultClientScript = "JScript" // DefaultHTMLPageLayout = "Grid" // DefaultTargetSchema = "IE50" // PreBuildEvent = "" // PostBuildEvent = "" // RunPostBuildEvent = "OnBuildSuccess" // transfer all config build options... if (GetBoolAttr(this.currentConfig, "AllowUnsafeBlocks")) { options.AllowUnsafeCode = true; } if (GetProjectProperty("BaseAddress", _PersistStorageType.PST_PROJECT_FILE, false) != null) { try { options.BaseAddress = Int64.Parse(GetProjectProperty("BaseAddress", _PersistStorageType.PST_PROJECT_FILE, false), CultureInfo.InvariantCulture); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } if (GetBoolAttr(this.currentConfig, "CheckForOverflowUnderflow")) { options.CheckedArithmetic = true; } if (GetProjectProperty("DefineConstants", _PersistStorageType.PST_PROJECT_FILE, false) != null) { options.DefinedPreprocessorSymbols = new StringCollection(); foreach (string s in GetProjectProperty("DefineConstants", _PersistStorageType.PST_PROJECT_FILE, false).Replace(" \t\r\n", "").Split(';')) { options.DefinedPreprocessorSymbols.Add(s); } } string docFile = GetProjectProperty("DocumentationFile", _PersistStorageType.PST_PROJECT_FILE, false); if (!String.IsNullOrEmpty(docFile)) { options.XmlDocFileName = Path.Combine(this.ProjectFolder, docFile); } if (GetBoolAttr(this.currentConfig, "DebugSymbols")) { options.IncludeDebugInformation = true; } if (GetProjectProperty("FileAlignment", _PersistStorageType.PST_PROJECT_FILE, false) != null) { try { options.FileAlignment = Int32.Parse(GetProjectProperty("FileAlignment", _PersistStorageType.PST_PROJECT_FILE, false), CultureInfo.InvariantCulture); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } if (GetBoolAttr(this.currentConfig, "IncrementalBuild")) { options.IncrementalCompile = true; } if (GetBoolAttr(this.currentConfig, "Optimize")) { options.Optimize = true; } if (GetBoolAttr(this.currentConfig, "RegisterForComInterop")) { } if (GetBoolAttr(this.currentConfig, "RemoveIntegerChecks")) { } if (GetBoolAttr(this.currentConfig, "TreatWarningsAsErrors")) { options.TreatWarningsAsErrors = true; } if (GetProjectProperty("WarningLevel", _PersistStorageType.PST_PROJECT_FILE, false) != null) { try { options.WarningLevel = Int32.Parse(GetProjectProperty("WarningLevel", _PersistStorageType.PST_PROJECT_FILE, false), CultureInfo.InvariantCulture); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (ArgumentException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (OverflowException e) { Trace.WriteLine("Exception : " + e.Message); } } this._options = options; // do this AFTER setting configuration so it doesn't clear it. return options; }