DllExporter: Fixed crash with VS2012

This commit is contained in:
Birunthan Mohanathas 2012-12-16 20:19:07 +02:00
parent 1acc613beb
commit e2a7f31a46
2 changed files with 20 additions and 2 deletions

View File

@ -79,6 +79,7 @@
<StartProgram>TestBench\x64\Release\Rainmeter.exe</StartProgram> <StartProgram>TestBench\x64\Release\Rainmeter.exe</StartProgram>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.Build.Utilities" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />

View File

@ -20,6 +20,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.Build.Utilities;
namespace DllExporter namespace DllExporter
{ {
@ -33,8 +34,24 @@ namespace DllExporter
string targetDllName = targetDirectory + args[3]; string targetDllName = targetDirectory + args[3];
string targetIlName = targetDllName + ".il"; string targetIlName = targetDllName + ".il";
string targetResName = targetDllName + ".res"; 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); System.IO.Directory.SetCurrentDirectory(targetDirectory);