From e2a7f31a46650ca8ed100aae27f29fd2a55e3de9 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 16 Dec 2012 20:19:07 +0200 Subject: [PATCH] DllExporter: Fixed crash with VS2012 --- Plugins/API/DllExporter/DllExporter.csproj | 1 + Plugins/API/DllExporter/Program.cs | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Plugins/API/DllExporter/DllExporter.csproj b/Plugins/API/DllExporter/DllExporter.csproj index 9b1295c5..6b74c8af 100644 --- a/Plugins/API/DllExporter/DllExporter.csproj +++ b/Plugins/API/DllExporter/DllExporter.csproj @@ -79,6 +79,7 @@ TestBench\x64\Release\Rainmeter.exe + diff --git a/Plugins/API/DllExporter/Program.cs b/Plugins/API/DllExporter/Program.cs index 92e76178..3920866a 100644 --- a/Plugins/API/DllExporter/Program.cs +++ b/Plugins/API/DllExporter/Program.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; +using Microsoft.Build.Utilities; namespace DllExporter { @@ -33,8 +34,24 @@ namespace DllExporter string targetDllName = targetDirectory + args[3]; string targetIlName = targetDllName + ".il"; string targetResName = targetDllName + ".res"; - string ilasmPath = args[4]; - string ildasmPath = args[5]; + + string ilasmPath = ToolLocationHelper.GetPathToDotNetFrameworkFile("ilasm.exe", TargetDotNetFrameworkVersion.Version20); + if (!System.IO.File.Exists(ilasmPath)) + { + Console.WriteLine("DllExporter error: ilasm.exe not found"); + return 1; + } + + string ildasmPath = Environment.ExpandEnvironmentVariables(@"%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\Bin\ildasm.exe"); + if (!System.IO.File.Exists(ildasmPath)) + { + ildasmPath = Environment.ExpandEnvironmentVariables(@"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\ildasm.exe"); + if (!System.IO.File.Exists(ildasmPath)) + { + Console.WriteLine("DllExporter error: ildasm.exe not found"); + return 1; + } + } System.IO.Directory.SetCurrentDirectory(targetDirectory);