dotnet publish-iis不起作用

时间:2016-05-19 23:06:11

标签: iis asp.net-core publish

我有一个ASP.NET Core RC2项目,我正在尝试将其发布到IIS并且命令dotnet publish-iis总是给出:

Asp.Net Core IIS Publisher
Usage: dotnet publish-iis [arguments] [options]
Arguments:
  <PROJECT>  The path to the project (project folder or project.json) being published. If empty the current directory is used.
Options:
  -h|--help                   Show help information
  --publish-folder|-p         The path to the publish output folder
  -f|--framework <FRAMEWORK>  Target framework of application being published

是否有一个如何运作的例子? 如何传递参数?它从不起作用......

2 个答案:

答案 0 :(得分:9)

--publish-folder--framework参数是必需的。如果您未提供这些参数,该工具将显示该用法。

说过实际上并不希望自己运行这个工具。 publish-iis的作用是它仅调整已发布应用程序的web.config文件(或者如果不存在则创建新的web.config),以便IIS / IISExpress可以找到要启动的应用程序。换句话说,你必须首先发布你的应用程序,然后发布 - 我只是按摩它一点点。因此,预期的用法是进行配置,使其作为postpublish脚本运行:

"scripts": {
  "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}

我在此post on running Asp.NET Core apps with IIS

中详细介绍了publish-iis工具

答案 1 :(得分:6)

对于 ASP.NET Core 1.1 。 project.json中的关键部分是:

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
  },

  "scripts": {
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
  }

对我来说很棒!