简体   繁体   中英

Visual Studio Project Types

I'm trying to make a web crawler/scraper in C# to get info from news articles and other text based websites and I've realized that I don't know what project type in visual to use or really what the difference between all of them is.

In the past I made most of my little programs in an empty c++ project.

Any advice would be helpful as I'm very new to C# and can code but the backend of visual still confuses me. I'm using the free visual studio 2015.

Thanks. My project options

I think the best type should be Console Application. With this type of project you can launch your application via console, or just executing the file directly.

static void Main(string[] args)
{
    Console.WriteLine("Hi i got nothing for you! Program me to be useful!");
}

例子

Also, you could add options to your crawler easily, eg the url :

static void Main(string[] args)
{
    if(args.Length == 1)
    {
        Console.WriteLine("I got this! Going to url \'{0}\'...", args[0]);
        // Doing something
        Console.WriteLine("Gotcha!");
        return;
    }

    Console.WriteLine("Hi i got nothing for you! Give me something to be useful!");
}

示例参数

It all depends on how you plan to use the application. If you want to run a .exe from the command line, a Console Application would suffice. If you want a UI, then probably Forms or Web. Or a combination of any of them (for instance, a solution that has core logic in a class library that is shared by both a console application and a website).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM