diff -r -c -N ../IceSL-0.4.1/vsaddin/src/Builder.cs vsaddin/src/Builder.cs *** ../IceSL-0.4.1/vsaddin/src/Builder.cs 2012-04-11 20:09:12.000000000 +0200 --- vsaddin/src/Builder.cs 2012-07-27 00:15:16.478515600 +0200 *************** *** 743,749 **** string iceHome = Util.getIceHome(); foreach(string component in components) { ! Util.addDotNetReference(project, component, iceHome, development); } } else if(Util.isVBProject(project)) --- 743,749 ---- string iceHome = Util.getIceHome(); foreach(string component in components) { ! Util.addDotNetReference(project, component, development); } } else if(Util.isVBProject(project)) *************** *** 761,767 **** } foreach(string component in components) { ! Util.addDotNetReference(project, component, iceHome, development); } } } --- 761,767 ---- } foreach(string component in components) { ! Util.addDotNetReference(project, component, development); } } } *************** *** 831,837 **** { project = document.ProjectItem.ContainingProject; } ! catch(COMException) { // // Expected when documents are created during project initialization --- 831,837 ---- { project = document.ProjectItem.ContainingProject; } ! catch(Exception) { // // Expected when documents are created during project initialization diff -r -c -N ../IceSL-0.4.1/vsaddin/src/IceCsharpConfigurationDialog.cs vsaddin/src/IceCsharpConfigurationDialog.cs *** ../IceSL-0.4.1/vsaddin/src/IceCsharpConfigurationDialog.cs 2012-04-11 20:09:12.000000000 +0200 --- vsaddin/src/IceCsharpConfigurationDialog.cs 2012-07-27 00:07:31.259765600 +0200 *************** *** 330,336 **** { if(value) { ! if(!Util.addDotNetReference(_project, name, Util.getIceHome(), development)) { checkComponent(name, false); } --- 330,336 ---- { if(value) { ! if(!Util.addDotNetReference(_project, name, development)) { checkComponent(name, false); } diff -r -c -N ../IceSL-0.4.1/vsaddin/src/IceVBConfigurationDialog.cs vsaddin/src/IceVBConfigurationDialog.cs *** ../IceSL-0.4.1/vsaddin/src/IceVBConfigurationDialog.cs 2012-04-11 20:09:12.000000000 +0200 --- vsaddin/src/IceVBConfigurationDialog.cs 2012-07-27 00:07:19.978515600 +0200 *************** *** 226,232 **** { if(value) { ! if(!Util.addDotNetReference(_project, name, Util.getIceHome(), development)) { checkComponent(name, false); } --- 226,232 ---- { if(value) { ! if(!Util.addDotNetReference(_project, name, development)) { checkComponent(name, false); } diff -r -c -N ../IceSL-0.4.1/vsaddin/src/Util.cs vsaddin/src/Util.cs *** ../IceSL-0.4.1/vsaddin/src/Util.cs 2012-04-11 20:09:12.000000000 +0200 --- vsaddin/src/Util.cs 2012-07-27 00:09:56.587890600 +0200 *************** *** 627,675 **** private static readonly string _csCompactFrameworkBinDirs = "\\bin\\cf\\"; private static readonly string _slBinDirs = "\\bin\\sl\\"; ! public static bool addDotNetReference(Project project, string component, string iceHome, bool development) { if(project == null || String.IsNullOrEmpty(component)) { return false; } ! string csBinDir = null; ! if(isVBSmartDeviceProject(project) || isCSharpSmartDeviceProject(project)) ! { ! csBinDir = _csCompactFrameworkBinDirs; ! } ! else if (isSilverlightProject(project)) ! { ! csBinDir = _slBinDirs; ! } ! else ! { ! csBinDir = _csBinDirs; ! } ! ! ! string reference = iceHome + csBinDir + component + ".dll"; ! if(File.Exists(reference)) { ! VSLangProj.VSProject vsProject = (VSLangProj.VSProject)project.Object; ! try ! { ! Reference r = vsProject.References.Add(reference); ! if (development) ! { ! r.CopyLocal = false; ! } ! return true; ! } ! catch (COMException ex) { ! Console.WriteLine(ex); } } ! MessageBox.Show("Could not locate '" + component + ! ".dll'. in '" + Path.GetDirectoryName(reference) + "'", "Ice Visual Studio Add-in", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, --- 627,656 ---- private static readonly string _csCompactFrameworkBinDirs = "\\bin\\cf\\"; private static readonly string _slBinDirs = "\\bin\\sl\\"; ! public static bool addDotNetReference(Project project, string component, bool development) { if(project == null || String.IsNullOrEmpty(component)) { return false; } ! string reference = component + ".dll"; ! VSLangProj.VSProject vsProject = (VSLangProj.VSProject)project.Object; ! try { ! Reference r = vsProject.References.Add(reference); ! if (development) { ! r.CopyLocal = false; } + return true; + } + catch (COMException ex) + { + Console.WriteLine(ex); } ! MessageBox.Show("Could not locate '" + component + ".dll'.", "Ice Visual Studio Add-in", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, *************** *** 2566,2609 **** { addIceCppConfigurations(project); ; } - else - { - string iceHome = getIceHome(); - string binDir = getCsBinDir(project); - ComponentList components = Util.getIceDotNetComponents(project); - - foreach(string component in components) - { - if (String.IsNullOrEmpty(component)) - { - continue; - } - - string reference = iceHome + binDir + component + ".dll"; - - // - // If Ice components are not from the current Ice home binary - // directory, we update the references to use the new value of - // Ice home. - // - bool development = developmentMode(project); - foreach(Reference r in ((VSProject)project.Object).References) - { - if(r.Name.Equals(component, StringComparison.OrdinalIgnoreCase)) - { - if(!r.Path.Equals(reference)) - { - bool copyLocal = getCopyLocal(project, component); - Util.removeDotNetReference(project, component); - - Util.addDotNetReference(project, component, iceHome, development); - setCopyLocal(project, component, copyLocal); - } - break; - } - } - } - } } public static bool addBuilderToProject(Project project, ComponentList components) --- 2547,2552 ----