It seems there is a small (yet problematic) bug in the vbc task. vbc is missing the abiltiy to handle the /main switch. Without /main, class libraries and console app's compile fine, but when attempting to compile a WinForms app, the compiler pukes and gives you the message "unable to locate sub main procedure". I initally thought this was a bug in the /target switch, but more investigation turned up /main. With /main, you have to specify the fully qualified type name to the class which is considered the "startup object". In my case, I needed to provide the following value:
/main:Turner.BSD.Orion.GUI.Framework.GUIFramework.frmMainView
This switch also exists for the C# compiler but I was not able to run any tests against it. Below is the code to fix the vbc task, it's been tested and seems to work fine. I image the same code needs to be implemented for the csc task. I didn't put this code in CompilerBase because the JScript compiler doesn't support /main.
Anyway, here's the code... --Don
// Added to the private members area
private string _main = null;
// Property accessor
/// <summary>Task specifies which type contains the Main method that you want to use as the entry point into the program.</summary> [TaskAttribute("main")] public string Main {
get{return _main;}
set{_main = value;}
}
// Code added to WriteOptions...
//Write out _main option...
if(_main != null)
writer.WriteLine("/main:{0}",_main);
Don Browning
Senior Software Developer
Turner Entertainment - 404.878.7043
