0
votes

I've problem with building and publishing project for IIS with VSTS build process. The problem is that web.config isn't updated by publish-iis command and web.config looks like this:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="false" />

I've postpublish section with publish-iis command in my project.json and it works localy. On VSTS I use preview .net core build. I've tried adding another build step with publish-iis command but i get an error:

2016-12-14T18:40:57.7097698Z [command]C:\Program Files\dotnet\dotnet.exe publish-iis C:/a/1/s/uberappseu/project.json --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%
2016-12-14T18:40:57.8326697Z No executable found matching command "dotnet-publish-iis"

Here is my project.json:

{
  "version": "1.1.0-*",

  // Used to store connection strings and other sensitive settings, so you don't have to check them into your source
  // control provider. Only use this in Development, it is not intended for Production use. See
  // http://docs.asp.net/en/latest/security/app-secrets.html

    "dependencies": {
        "Boilerplate.AspNetCore": "2.0.0",
        "Boilerplate.AspNetCore.TagHelpers": "2.0.0",
        "Microsoft.AspNetCore.CookiePolicy": "1.1.0",
        "Microsoft.AspNetCore.Diagnostics": "1.1.0",
        "Microsoft.AspNetCore.Mvc": "1.1.0",
        "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
        "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
        "Microsoft.AspNetCore.StaticFiles": "1.1.0",
        "Microsoft.Extensions.Configuration.Binder": "1.1.0",
        "Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
        "Microsoft.Extensions.Configuration.Json": "1.1.0",
        "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
        "Microsoft.Extensions.Logging": "1.1.0",
        "Microsoft.Extensions.Logging.Console": "1.1.0",
        "Microsoft.Extensions.Logging.Debug": "1.1.0",
        "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
        "Microsoft.NETCore.App": "1.1.0",
        "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
        "Newtonsoft.Json": "9.0.1"
    },

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

  // Command line tools which can be run using 'dotnet [Tool Name]'.
    "tools": {
        "Microsoft.AspNetCore.Razor.Tools": "1.0.0",
        "Microsoft.Extensions.SecretManager.Tools": "1.0.0",
        "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0"
    },

  "buildOptions": {
    "compile": {
      // Ignore the following folders when looking for C# code to compile.
      "exclude": [
        "node_modules",
        "wwwroot"
      ]
    },
    // Use the new portable .pdb file format.
    "debugType": "portable",
    // Require the application to use a static Main method.
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      // Concurrent - Specifies whether the common language runtime runs garbage collection on a separate thread
      //              (See https://msdn.microsoft.com/en-us/library/yhwwzef8%28v=vs.110%29.aspx).
      "System.GC.Concurrent": true,
      // Server - Specifies whether the common language runtime runs server garbage collection.
      //          (See https://msdn.microsoft.com/en-us/library/ms229357%28v=vs.110%29.aspx).
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    // Include the following folders and files when publishing the project.
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "config.json",
      "web.config"
    ]
  },

  "scripts": {
    // Execute the following commands before publishing the project.
    "prepublish": [
      "npm install",
      "gulp build"
    ],
    // Execute the following commands after publishing the project.
    "postpublish": [
      "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
    ]
  }

}

UPDATE: Here are build logs for my app:

http://pastebin.com/8CA0CruR

UPDATE 2: I've found thease lines in log after publish command:

2016-12-15T15:12:32.5732645Z   - Check application dependencies and target a framework version installed at:
2016-12-15T15:12:32.5732645Z       C:\Program Files\dotnet\shared\Microsoft.NETCore.App
2016-12-15T15:12:32.5732645Z   - The following versions are installed:
2016-12-15T15:12:32.5732645Z       1.0.0
2016-12-15T15:12:32.5732645Z       1.0.1
2016-12-15T15:12:32.5732645Z   - Alternatively, install the framework version '1.1.0'.

So it looks like Microsoft.NETCore.App 1.1.0 is not available on build agent.


UPDATE 3: I've prepared the test project which simulates this issue. I think the problem is caused by absence of NetCore1.1 on build server. However I use Hosted Agent from VSTS and according to it's documentation the Net Core framework 1.1 should be installed there (https://www.visualstudio.com/en-us/docs/build/admin/agents/hosted-pool).

Logs: https://ufile.io/99b99 Project: https://ufile.io/c8af5

I think that conclusion is that is should report it as a bug and move back to older version of IIS tools.

2
I can't reproduce that issue. Do you use hosted agent or on premise agent? If you are using hosted agent, how do you check web.config file? If you are using on premise agent, what's the result if you publish app by running dotnet publish command in build agent machine? Which web.config file you checked? Is it in published folder (e.g. bin/release/publish)?starian chen-MSFT
On the other hand, for command line build step, using dotnet publish instead (tool: C:\Program Files\dotnet\dotnet.exe, Arguments: publish --configuration $(BuildConfiguration)), it will call the command in postpublish of project.json.starian chen-MSFT
Im checking in after deploy to server. If I change the web.config to use dotnet and app.dll site works. Im using hosted agent. I've done some tests. I've removed the "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0" package and in build logs there was error that publish-iis command wasn't found. When I've restored the package the error has gone but there is no info about command execution. So I think it's executed but it doesn't work correctly. I've also tried to update all tools to "1.1.0-preview4-final" versions. Didn't help.Paulie
What're detail steps to check web.config? You can provide the detail steps here.starian chen-MSFT
mywebsite.scm.azurewebsites.net/DebugConsole/?shell=powershell -> D:\home\site\wwwroot> -> web.config Also there is IIS error 502.5 when entering sitePaulie

2 Answers

1
votes

Using Microsoft.AspNetCore.Server.IISIntegration.Tools 1.0.0-preview2-final instead, it is working fine. (Higher than this version have that issue)

0
votes

The problem is that the version of tools you are using is incorrect. If you look at the Microsoft.AspNetCore.Server.IISIntegration.Tools package on NuGet you will see that the "1.1.0" version does not exist. Same applies to other tools. For 1.1.0 runtime the version for tools you want to use is "1.1.0-preview4-final"