The latest travesty inflicted upon me is an annoying popup dialog that rears its ill-thought out head every time I compile a project that contains it. Which just happens to be 22 times during a normal compile of my most commonly used solution. This happens because I reinstalled my OS and didn't reinstall the component library, but I don't really care why or why it is difficult for me to get another license or behave like a reasonable adult. This is my computer and you're infecting it with malware. You suck.
Step one: turn Visual Studio on itself and break the code when the annoying dialog is in my face.
As it turns out, VS is calling an external process called lc.exe interesting...
What to do... Rename lc.exe to lc.exe.old, copy notepad and rename it lc.exe, and copy my new notepad-lc.exe into the directory where lc.exe was. Then recompile.
Notepad pops up instead of my annoying dialog. What fun. But no less annoying really.
Step two: create a console project that does absolutely nothing. Name it lc.exe. Copy it to the directory where I found lc.exe. Result: happiness.
However, my happiness was relatively short lived. It turns out that a subsequent program vbc.exe is looking for the lc.exe's output. Something called <filename>.exe.licenses.
Step three: alter my lc.exe program to create an empty file called <filename>.exe.licenses in the output directory.
That time it worked and I shall never be bothered by that particular annoying popup again. I will probably run across another third party component that was clever enough to withstand this fix eventually, but until then, my lc.exe shall make me smile and compile much faster and with far less annoyance.
1 class Program
2 {
3 static void Main(string[] args)
4 {
5 Console.WriteLine("End.");
6 string path = string.Empty;
7 string dllName = string.Empty;
8
9 //'/target:WIN.Contest.Host.dll /complist:Properties\licenses.licx /outdir:"obj\Debug - Fast\\"
10 foreach(string arg in args)
11 {
12 Console.WriteLine(arg);
13 System.Diagnostics.Debug.WriteLine(arg);
14
15 if (arg.StartsWith("/target:"))
16 {
17 dllName = arg.Substring(8);
18 }
19 else if (arg.StartsWith("/outdir:"))
20 {
21 path = arg.Substring(8);
22 }
23 }
24
25 string outputFilename = System.IO.Path.Combine(path, dllName);
26 outputFilename += ".licenses";
27
28 System.IO.File.CreateText(outputFilename);
29
30 Console.ReadLine();
31 }
32 }
This worked for a while, but failed when I actually tried to use some of the irritating gui components that I hate. So I settled on another solution.
AutoHotKey
I wrote an autohot key script that lies in wait for the dialog to pop up, then it closes it. So now I never see the dialog and don't have to explore the guts of Visual Studio further, nor do I have to play nice with the irritating 3rd party.
No comments:
Post a Comment