asp.net - 找不到与命令 "dotnet-./..dll"匹配的可执行文件

标签 asp.net heroku asp.net-core

我在 .NET Core 中编写了一个 API,在本地运行时效果很好,但部署到 Azure 或 Heroku 时在日志中出现了相同的错误:找不到与命令“dotnet-./..dll 匹配的可执行文件” “。我在下面包含了我的project.json,我不确定还有哪些其他信息会有帮助。谢谢!

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.0",
    "Microsoft.EntityFrameworkCore.Design": {
      "version": "1.0.0-preview2-final",
      "type": "build" 
    }
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "tooling": {
    "defaultNamespace": "Tokens_monolith"
  }
}

最佳答案

此处的问题是 .bin 文件夹中的 dll 文件的命名与父文件夹名称不同。我将此行添加到我的 project.json 文件中:

"buildOptions": {
   "outputName": "whatever-you-want-it-to-be"
}

我重新构建了我的应用程序,一切似乎都运行良好。所有 dll 文件名都已更改,因此我重新部署到服务器。希望这有帮助!

关于asp.net - 找不到与命令 "dotnet-./..dll"匹配的可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38950016/

相关文章:

asp.net-core - 无法执行 dotnet swagger 命令

c# - 如何知道 asp.net 站点是从移动设备还是从系统/笔记本电脑/机器(windows、mac 等)访问的

asp.net - 如何关闭 Visual Studio 2008 中的对齐线?

python - Heroku 上的 Flask 应用程序出现错误 : TypeError: 'unicode' does not have the buffer interface

node.js - 什么是Procfile?和 Web 和 Worker

c# - Asp.net Core RequestSizeLimit 仍然执行 Action

c# - 关于将net core app部署到heroku服务器

javascript - JQuery AJAX 不会抛出错误,但也不能正常工作

asp.net - 我可以强制刷新我的样式表文件吗?

java - 连接到 StompClient 时我可能在哪里出错?