public void SetIceHome(String value) { if (String.IsNullOrEmpty(value)) { // // Remove all registry settings. // Microsoft.Win32.Registry.SetValue(IceHomeKey, IceHomeValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceIntVersionValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionMMValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceCSharpAssembleyKey, "", "", Microsoft.Win32.RegistryValueKind.String); if (DTE2.Solution != null) { MSBuildUtils.SetIceHome(DTEUtil.GetProjects(DTE2.Solution), "", "", "", ""); } return; } else { Version v = null; try { String compiler = GetSliceCompilerVersion(value); if (String.IsNullOrEmpty(compiler)) { string err = "Unable to find a valid Ice installation in `" + value + "'"; MessageBox.Show(err, "Ice Builder", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); return; } else { v = Version.Parse(compiler); } } catch (System.Exception ex) { string err = "Failed to run Slice compiler using Ice installation from `" + value + "'" + "\n" + ex.ToString(); MessageBox.Show(err, "Ice Builder", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); return; } Microsoft.Win32.Registry.SetValue(IceHomeKey, IceHomeValue, value, Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionValue, v.ToString(), Microsoft.Win32.RegistryValueKind.String); String iceIntVersion = String.Format("{0}{1:00}{2:00}", v.Major, v.Minor, v.Build); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceIntVersionValue, iceIntVersion, Microsoft.Win32.RegistryValueKind.String); String iceVersionMM = String.Format("{0}.{1}", v.Major, v.Minor); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionMMValue, iceVersionMM, Microsoft.Win32.RegistryValueKind.String); if (DTE2.Solution != null) { MSBuildUtils.SetIceHome(DTEUtil.GetProjects(DTE2.Solution), value, v.ToString(), iceIntVersion, iceVersionMM); } Microsoft.Win32.Registry.SetValue(IceCSharpAssembleyKey, "", GetAssembliesDir(value), Microsoft.Win32.RegistryValueKind.String); } }
public void SetIceHome(String value) { if (String.IsNullOrEmpty(value)) { // // Remove all registry settings. // Microsoft.Win32.Registry.SetValue(IceHomeKey, IceHomeValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceIntVersionValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionMMValue, "", Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceCSharpAssembleyKey, "", "", Microsoft.Win32.RegistryValueKind.String); MSBuildUtils.SetIceHome(DTEUtil.GetProjects(), "", "", "", ""); return; } else { String props = File.Exists(Path.Combine(value, "config", "Ice.props")) ? Path.Combine(value, "config", "Ice.props") : File.Exists(Path.Combine(value, "cpp", "config", "Ice.props")) ? Path.Combine(value, "cpp", "config", "Ice.props") : File.Exists(Path.Combine(value, "build", "native", "Ice.props")) ? Path.Combine(value, "build", "native", "Ice.props") : null; if (!String.IsNullOrEmpty(props)) { Microsoft.Build.Evaluation.Project p = new Microsoft.Build.Evaluation.Project( props, new Dictionary <String, String>() { { "ICE_HOME", value } }, null); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceHomeValue, value, Microsoft.Win32.RegistryValueKind.String); String version = p.GetPropertyValue(IceVersionValue); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionValue, version, Microsoft.Win32.RegistryValueKind.String); String intVersion = p.GetPropertyValue(IceIntVersionValue); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceIntVersionValue, intVersion, Microsoft.Win32.RegistryValueKind.String); String mmVersion = p.GetPropertyValue(IceVersionMMValue); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionMMValue, mmVersion, Microsoft.Win32.RegistryValueKind.String); MSBuildUtils.SetIceHome(DTEUtil.GetProjects(), value, version, intVersion, mmVersion); Microsoft.Win32.Registry.SetValue(IceCSharpAssembleyKey, "", GetAssembliesDir(value), Microsoft.Win32.RegistryValueKind.String); ICollection <Microsoft.Build.Evaluation.Project> projects = Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.GetLoadedProjects(props); if (projects.Count > 0) { Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.UnloadProject(p); } } else { Version v = null; try { String compiler = GetSliceCompilerVersion(value); if (String.IsNullOrEmpty(compiler)) { string err = "Unable to find a valid Ice installation in `" + value + "'"; MessageBox.Show(err, "Ice Builder", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); return; } else { v = Version.Parse(compiler); } } catch (System.Exception ex) { string err = "Failed to run Slice compiler using Ice installation from `" + value + "'" + "\n" + ex.ToString(); MessageBox.Show(err, "Ice Builder", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); return; } Microsoft.Win32.Registry.SetValue(IceHomeKey, IceHomeValue, value, Microsoft.Win32.RegistryValueKind.String); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionValue, v.ToString(), Microsoft.Win32.RegistryValueKind.String); String iceIntVersion = String.Format("{0}{1:00}{2:00}", v.Major, v.Minor, v.Build); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceIntVersionValue, iceIntVersion, Microsoft.Win32.RegistryValueKind.String); String iceVersionMM = String.Format("{0}.{1}", v.Major, v.Minor); Microsoft.Win32.Registry.SetValue(IceHomeKey, IceVersionMMValue, iceVersionMM, Microsoft.Win32.RegistryValueKind.String); MSBuildUtils.SetIceHome(DTEUtil.GetProjects(), value, v.ToString(), iceIntVersion, iceVersionMM); Microsoft.Win32.Registry.SetValue(IceCSharpAssembleyKey, "", GetAssembliesDir(value), Microsoft.Win32.RegistryValueKind.String); } } }