简体   繁体   English

Visual Studio 项目类型

[英]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.我正在尝试在 C# 中制作一个网络爬虫/抓取工具,以从新闻文章和其他基于文本的网站中获取信息,但我意识到我不知道要使用的视觉项目类型,也不知道所有这些之间的区别他们是。

In the past I made most of my little programs in an empty c++ project.过去,我在一个空的 c++ 项目中制作了大部分小程序。

Any advice would be helpful as I'm very new to C# and can code but the backend of visual still confuses me.任何建议都会有所帮助,因为我对 C# 非常陌生并且可以编码,但视觉后端仍然让我感到困惑。 I'm using the free visual studio 2015.我正在使用免费的 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 :此外,您可以轻松地向您的爬虫添加选项,例如 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.如果您想从命令行运行 .exe,控制台应用程序就足够了。 If you want a UI, then probably Forms or Web.如果您想要 UI,那么可能是 Forms 或 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).或者它们中的任何一个的组合(例如,在类库中具有核心逻辑的解决方案,该类库由控制台应用程序和网站共享)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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