我在使用VSTS构建过程构建和发布IIS项目时遇到了问题。问题是web.config没有被publish-iis命令更新,web.config看起来像这样:
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="false" />
我在我的project.json中使用publish-iis命令后发布部分,并且它可以在localy中运行。在VSTS上我使用预览.net核心构建。我尝试使用publish-iis命令添加另一个构建步骤,但是我收到错误:
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:
{
"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%"
]
}
更新: 以下是我的应用的构建日志:
更新2: 我在发布命令后在日志中找到了这些行:
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在构建代理上不可用。
更新3: 我准备了模拟这个问题的测试项目。我认为问题是由于构建服务器上缺少NetCore1.1引起的。但是我使用来自VSTS的Hosted Agent,根据它的文档,应该在那里安装Net Core framework 1.1(https://www.visualstudio.com/en-us/docs/build/admin/agents/hosted-pool)。
日志:https://ufile.io/99b99 项目:https://ufile.io/c8af5
我认为结论是应该将其报告为错误并返回到旧版本的IIS工具。
答案 0 :(得分:1)
使用Microsoft.AspNetCore.Server.IISIntegration.Tools 1.0.0-preview2-final代替,它工作正常。 (高于此版本的问题)
答案 1 :(得分:0)
问题是您使用的工具版本不正确。如果您查看Microsoft.AspNetCore.Server.IISIntegration.Tools package on NuGet,您会看到&#34; 1.1.0&#34;版本不存在。同样适用于其他工具。对于1.1.0运行时,您要使用的工具版本为&#34; 1.1.0-preview4-final&#34;