[英]A project with an Output Type of Class Library cannot be started directly , Azure Function in VS 2022
I have recently updated my VS to 2022. My project is Azure Function App.我最近将我的 VS 更新到 2022。我的项目是 Azure Function 应用程序。
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.通常,我的 Function 应用程序运行时会出现提示屏幕。
What could be the issue?可能是什么问题?
Strange, because azure function work in VS2022 without any issue for me, which version of target framework is used in your function?奇怪,因为 azure function 在 VS2022 中工作对我来说没有任何问题,您的 function 中使用了哪个版本的目标框架?
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您可以尝试以下几种解决方法
Try cleaning and rebuilding your solution.尝试清理并重建您的解决方案。
If you have multiple projects try setting up a startup project and then compile the same.如果您有多个项目,请尝试设置一个启动项目,然后编译相同的项目。
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.如果上述方法不起作用,请尝试将新项目添加到您的解决方案中,并将 Output 类型设置为控制台应用程序或 Windows 应用程序。 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 REFERENCES: Output 类型为 Class 库的项目无法直接启动
I got it working.我让它工作了。 Seems that during installation Azure Development was not selected.
似乎在安装过程中没有选择 Azure Development。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.