I downloaded a zip of source files containing a C# project with multiple entry points / Main methods. Since I wanted to tinker around, I created another one like this in a new type/class
class MyExperiments
{
static void Main(String[] args)
{
// do something
}
}
then I switched to project properties. Simply switch the startup object to MyExperiments eh? To my surprise, the dropdown didn't have it. I rebuilt, made the method public, tried a whole lot of stuff.. but to no avail. Finally I edited the .csproj manually in notepad and then it worked. More tinkering around, I removed the parameters to make it
static void Main()
and now VS Project properties could 'see' the startup object. So now I could select it using the dropdown. I then added the String[] back and everything still worked.
Seems a bit weird to me (because the most common form is a Main method with parameters for command line args from the C/C++ times). MSDN says the dropdown will contain valid startup objects if they exist in your project.
Good thing you copy-pasted it, it is the capital 'S' in Main(String[] args)
. Apparently VS uses some text matching, and it's case sensitive. As it probably should be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With