找不到 运行 的项目。确保项目存在于 D:\home\site\wwwroot

Couldn't find a project to run. Ensure a project exists in D:\home\site\wwwroot

我一直在努力解决这个问题。我正在尝试让我的 ASP.NET Core 2.1 应用在 Azure 应用服务上 运行。

这是我在 Kudu 中看到的奇怪行为。

我在 D:\home\site\wwwroot 的 Kudu 控制台中看到我项目的 dll 文件。然后我输入 dotnet run myproject.dll 并收到以下错误:

Couldn't find a project to run. Ensure a project exists in D:\home\site\wwwroot

知道这里发生了什么吗?

来自docs

The dotnet run command is used in the context of projects, not built assemblies. If you're trying to run a framework-dependent application DLL instead, you must use dotnet without a command.

所以尝试 运行 像这样

dotnet myproject.dll

我遇到了同样的问题。不确定这是否是 work-around 但它是 运行 代码。

dotnet run --project name-of-your-project-here

使用以下命令转到您的 dll 和 运行 的路径:

dotnet yourprojectname.dll

该解决方案由一个或多个项目组成,并且dotnet命令在项目上下文中使用,因此:您需要先将目录更改为项目文件夹,然后运行命令:

cd ProjectName
dotnet run       // or even "dotnet add package <Package Name>"