Dotnet publish-iis is looking for web.config in the wrong place

I am having trouble working correctly dotnet publish-iis.

To publish my project, I use:

dotnet publish ./src/RetailGuardian.Web/ -o ./code_drop/RetailGuardian.Web --runtime dnet452

and I installed the postpublish script in mine project.json:

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

The initial publication works correctly and places the code in the code_drop directory as expected (this was what I used to deploy to RC1, and it worked fine). However, publication-iis does not seem to use the exit path when trying to find web.config. This is the result of execution:

Configuring the following project for use with IIS: './code_drop/RetailGuardian.Web'
No web.config found. Creating './code_drop/RetailGuardian.Web\web.config'
Could not find a part of the path 'G:\Projects\retailguardian\src\RetailGuardian.Web\code_drop\RetailGuardian.Web\web.config'.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'G:\Projects\retailguardian\src\RetailGuardian.Web\code_drop\RetailGuardian.Web\web.config'.
   at System.IO.Win32FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent)
   at System.IO.Win32FileSystem.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, Int32
bufferSize, FileOptions options, FileStream parent)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at Microsoft.AspNetCore.Server.IISIntegration.Tools.PublishIISCommand.Run()
   at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.<>c__DisplayClass0_0.<Main>b__0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String[] args)
publish: Published to ./code_drop/RetailGuardian.Web
Published 1/1 projects successfully

So he is trying to use G:\Projects\retailguardian\src\RetailGuardian.Web\code_drop\RetailGuardian.Web\web.configwhich is the source directory, not G:\Projects\retailguardian\code_drop\RetailGuardian.Web\web.configwhere the publication is located.

(Curiously, he also reports that the publication was successful, although postpublish fails)

+4
2

, , dotnet , , , , , , - cli: https://github.com/dotnet/cli/issues/3528

:

+6

, web.config include → publishOptions project.json:

  "publishOptions": {
    "include": [
       ...
      "web.config"
    ]
  }
0

All Articles