IIS的Visual Studio Team Services asp.net核心版本 [英] Visual Studio Team Services asp.net core build for IIS
问题描述
我在使用VSTS构建过程为IIS构建和发布项目时遇到问题.问题是publish-iis命令不会更新web.config,而web.config看起来像这样:
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" />
我在我的project.json中使用publish-iis命令进行了postpublish节,它在本地工作.在VSTS上,我使用Preview .net核心版本.我尝试使用publish-iis命令添加另一个构建步骤,但出现错误:
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"
这是我的project.json:
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:
更新2:发布命令后,我在日志中找到了thease行:
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'.
因此看起来Microsoft.NETCore.App 1.1.0在构建代理上不可用.
So it looks like Microsoft.NETCore.App 1.1.0 is not available on build agent.
更新3:我已经准备了模拟这个问题的测试项目.我认为问题是由构建服务器上缺少NetCore1.1引起的.但是我使用了VSTS的Hosted Agent,根据它的文档,Net Core Framework 1.1应该安装在此处(
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).
日志: https://ufile.io/99b99 项目: https://ufile.io/c8af5
我认为结论是应该将其报告为错误,然后移回旧版IIS工具.
I think that conclusion is that is should report it as a bug and move back to older version of IIS tools.
推荐答案
使用Microsoft.AspNetCore.Server.IISIntegration.Tools 1.0.0-preview2-final可以正常工作.(高于此版本的版本存在该问题)
Using Microsoft.AspNetCore.Server.IISIntegration.Tools 1.0.0-preview2-final instead, it is working fine. (Higher than this version have that issue)
这篇关于IIS的Visual Studio Team Services asp.net核心版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!