Home > Software design >  A project with an Output Type of Class Library cannot be started directly , Azure Function in VS 202
A project with an Output Type of Class Library cannot be started directly , Azure Function in VS 202

Time:12-30

I have recently updated my VS to 2022. My project is Azure Function App.

But when I click on debug item, I am getting the following error.

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.

Usually, I prompt screen would appear with my Function app running.

What could be the issue?

CodePudding user response:

Strange, because azure function work in VS2022 without any issue for me, which version of target framework is used in your function?

CodePudding user response:

Try cleaning and rebuilding your project. Also, if you have multiple projects try setting up a startup project and then compile the same.

Here are few workarounds that you can try

  1. Try cleaning and rebuilding your solution.

  2. If you have multiple projects try setting up a startup project and then compile the same.

    enter image description here

  3. If the above doesn't work try adding a new project to your solution and set Output Type of either Console Application or Windows Application. For this you can navigate to your properties by right clicking on your project

REFERENCES: A project with an Output type of Class Library cannot be started directly

CodePudding user response:

I got it working. Seems that during installation Azure Development was not selected.

  • Related