-2

I have installed Async-CTP-v3 for using new feature of C# 5 but when I tried to run a console application using async keyword/await expression this error appeared:

"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."

Is there anyone can help me? Thanks.

svick
  • 236,525
  • 50
  • 385
  • 514
Azad
  • 407
  • 1
  • 9
  • 22
  • 4
    The error message strongly suggests you didn't actually create a console application. Project + Properties, Application tab, Output type combo. – Hans Passant Jul 30 '12 at 20:00
  • Or that the OP *has* created a console app... but that that's not the startup project. – Jon Skeet Jul 30 '12 at 20:01
  • You haven't run a "console application" if VS is telling you it's trying to run a class library. – Peter Ritchie Jul 30 '12 at 20:01
  • Possible duplicate of ["A project with an Output type of Class Library cannot be started directly"](https://stackoverflow.com/questions/3363106/a-project-with-an-output-type-of-class-library-cannot-be-started-directly) – kenorb Sep 18 '18 at 16:14

1 Answers1

3

Your project's output type is almost certainly set to "Class Library".

You can change the Project's Output type by right-clicking on your project in Solution Explorer and selecting properties in the context menu. Here you can choose the Output type from a drop-down menu. Change your project's output type from "Class Library" to "Console Application"

If that does not work, double check your startup project and make sure it's the project you think it is (and should be).

Vikranth
  • 163
  • 1
  • 5
Ed S.
  • 122,712
  • 22
  • 185
  • 265