“不能直接启动具有类库的输出类型的项目". [英] "A project with an Output type of Class Library cannot be started directly"

查看:63
本文介绍了“不能直接启动具有类库的输出类型的项目".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了一个C#项目,并希望对该项目进行调试,以了解算法实现的工作原理.

I downloaded a C# project and I wish to debug the project to see how an algorithm implementation works.

该项目位于一个文件夹中,在该文件夹中有-

The project has come in a Folder, inside this folder there are -

  1. .sln文件
  2. 包含源文件和.csproj文件的文件夹.
  1. .sln file and
  2. a folder which has source files and a .csproj file.

我安装了Visual Studio,并打开了主文件夹中的.sln文件.我成功构建了项目,但是当我尝试调试项目时,我收到以下消息:

I installed Visual Studio and opened the .sln file present in the main folder. I built the project successfully, but when I try to debug the project I get this message:

不能直接启动具有类库输出类型的项目.为了调试该项目,请向该解决方案中添加一个引用该库项目的可执行项目.将可执行项目设置为启动项目.

A project with an Output type of Class Library cannot be started directly In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.

奇怪的是,我在任何地方都看不到主要功能.

The strange part is that I don't see a main function anywhere.

我应该怎么做才能解决这个问题?

What should I do to get round this hiccup?

推荐答案

您下载的项目将编译为dll程序集,并提供一组具有已实现功能的类.

The project you have downloaded compiles into a dll assembly and provide a set of classes with implemented functionality.

您应将具有控制台应用程序或Windows应用程序输出类型的新项目添加到解决方案中(VS添加项目向导将为您提供不同的项目模板).

You should add to your solution a new project with Output Type of either Console Application or Windows Application (VS Add Project wizard will offer you different templates of Projects).

在新添加的项目中,您可以实现逻辑来测试您的类库.

In the newly added project, you can implement logic to test your Class Library.

您可以通过以下步骤找到并更改项目的输出类型:

Output type of the project you can find and change by the following steps:

  1. 在解决方案资源管理器->属性中右键单击项目.

  1. Right click on project in Solution Explorer -> Properties.

在打开的带有属性的选项卡中,选择应用程序",然后将出现带有输出类型"标签的ComboBox.

In opened tab with properties select Application and there will be ComboBox marked with Output Type label.

这篇关于“不能直接启动具有类库的输出类型的项目".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆