summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vsaddin/src/Builder.cs69
-rw-r--r--vsaddin/src/Util.cs18
2 files changed, 70 insertions, 17 deletions
diff --git a/vsaddin/src/Builder.cs b/vsaddin/src/Builder.cs
index 4bdad73b700..7773b62cdc5 100644
--- a/vsaddin/src/Builder.cs
+++ b/vsaddin/src/Builder.cs
@@ -1555,22 +1555,63 @@ namespace Ice.VisualStudio
}
public static string getSliceCompilerVersion(Project project, string sliceCompiler)
- {
- System.Diagnostics.Process process;
- ProcessStartInfo processInfo = new ProcessStartInfo(sliceCompiler, "-v");
- processInfo.CreateNoWindow = true;
- processInfo.UseShellExecute = false;
- processInfo.RedirectStandardError = true;
- processInfo.RedirectStandardOutput = true;
- processInfo.WorkingDirectory = Path.GetDirectoryName(project.FileName);
-
- process = System.Diagnostics.Process.Start(processInfo);
+ {
+ System.Diagnostics.Process process = new System.Diagnostics.Process();
+ process.StartInfo.FileName = Path.Combine(Util.getIceHome(), "bin\\" + sliceCompiler);
+ process.StartInfo.Arguments = "-v";
+ process.StartInfo.CreateNoWindow = true;
+ process.StartInfo.UseShellExecute = false;
+ process.StartInfo.RedirectStandardError = true;
+ process.StartInfo.RedirectStandardOutput = true;
+ process.StartInfo.WorkingDirectory = Path.GetDirectoryName(project.FileName);
+
+ StreamReader reader = new StreamReader();
+ process.OutputDataReceived += new DataReceivedEventHandler(reader.appendData);
+
+ try
+ {
+ process.Start();
+ }
+ catch(InvalidOperationException ex)
+ {
+ Util.write(project, Util.msgLevel.msgError,
+ "An exception was thrown when trying to start the slice compiler\n" +
+ ex.ToString());
+
+ Connect.getBuilder().addError(project, "", TaskErrorCategory.Error, 0, 0,
+ "An exception was thrown when trying to start slice compiler\n" +
+ ex.ToString());
+ return "";
+ }
+ catch(System.ComponentModel.Win32Exception ex)
+ {
+ Util.write(project, Util.msgLevel.msgError,
+ "An exception was thrown when trying to start the slice compiler\n" +
+ ex.ToString());
+ Connect.getBuilder().addError(project, "", TaskErrorCategory.Error, 0, 0,
+ "An exception was thrown when trying to start slice compiler\n" +
+ ex.ToString());
+ return "";
+ }
+
+ // Start the asynchronous read of the standard output stream.
+ process.BeginOutputReadLine();
+ string version = process.StandardError.ReadToEnd();
process.WaitForExit();
- string version = process.StandardOutput.ReadLine();
- if(version == null)
- {
- return "";
+
+ if(String.IsNullOrEmpty(version))
+ {
+ //
+ // Some old version of slice compilers print version
+ // to StdOut instead of StdErr
+ //
+ version = reader.data();
+ if(String.IsNullOrEmpty(version))
+ {
+ return "";
+ }
}
+
return version.Trim();
}
diff --git a/vsaddin/src/Util.cs b/vsaddin/src/Util.cs
index 6f2e8ed157e..274a9bbd8e3 100644
--- a/vsaddin/src/Util.cs
+++ b/vsaddin/src/Util.cs
@@ -2353,8 +2353,19 @@ namespace Ice.VisualStudio
{
string iceHome = getIceHome();
string binDir = getCsBinDir(project);
- ComponentList components = Util.getIceDotNetComponents(project);
- foreach (string component in components)
+ ComponentList components = Util.getIceDotNetComponents(project);
+ String version = Builder.getSliceCompilerVersion(project, Util.slice2cs);
+
+ string[] tokens = version.Split('.');
+ //
+ // Add patch version 0 if there isn't one
+ //
+ if(tokens.Length == 3)
+ {
+ version += ".0";
+ }
+
+ foreach(string component in components)
{
if (String.IsNullOrEmpty(component))
{
@@ -2373,7 +2384,8 @@ namespace Ice.VisualStudio
{
if(r.Name.Equals(component, StringComparison.OrdinalIgnoreCase))
{
- if(!r.Path.Equals(reference))
+ if(!r.Path.Equals(reference) ||
+ !r.Version.Equals(version))
{
bool copyLocal = getCopyLocal(project, component);
Util.removeDotNetReference(project, component);