简体   繁体   中英

Visual Studio Team Services asp.net core build for IIS

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.

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM