Dotnet Core 1.1 Azure 部署:未找到匹配命令的可执行文件 "dotnet-publish-iis"
Dotnet Core 1.1 Azure Deployment: No executable found matching command "dotnet-publish-iis"
我在通过 git 部署到 Azure 时遇到问题。当 PostCompile
命令在应用程序发布到服务器后运行时,我的名为 Blogg
的应用程序一直挂起。该命令是:
<Exec Command="dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" />
我的印象是这个命令的包引用来自 Microsoft.AspNetCore.Server.IISIntegration
但即使在添加版本 1.1.0-preview4-final
和 1.1.2
(最新)之后,我仍然有烦恼。
如果有用,下面是我的 .csproj 文件中的内容:
`<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.sqlserver.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild2-final" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot/*" CopyToPublishDirectory="Always" />
<None Include="Views/*" CopyToPublishDirectory="Always" />
<None Include="web.config" CopyToPublishDirectory="Always" />
</ItemGroup>
<Target Name="MyPostCompileTarget" AfterTargets="Publish">
<Exec Command="dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" />
</Target>
</Project>`
我从 Azure 日志中得到的错误:
`Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restoring packages for D:\home\site\repository\Blogg.csproj...
D:\Program Files (x86)\dotnet\sdk.0.0-rc4-004771\NuGet.targets(97,5): warning : Dependency specified was Microsoft.AspNetCore.Server.IISIntegration (>= 1.1.0-preview4-final) but ended up with Microsoft.AspNetCore.Server.IISIntegration 1.1.0. [D:\home\site\repository\Blogg.csproj]
Installing Microsoft.AspNetCore.Http.Features 1.1.0.
Installing Microsoft.AspNetCore.Hosting.Server.Abstractions 1.1.0.
Installing Microsoft.Extensions.Configuration.Abstractions 1.1.0.
Installing Microsoft.AspNetCore.Http.Abstractions 1.1.0.
Installing Microsoft.AspNetCore.WebUtilities 1.1.0.
Installing Microsoft.Extensions.ObjectPool 1.1.0.
Installing Microsoft.Net.Http.Headers 1.1.0.
Installing Microsoft.AspNetCore.Http.Extensions 1.1.0.
Installing Microsoft.AspNetCore.Hosting.Abstractions 1.1.0.
Installing Microsoft.AspNetCore.Http 1.1.0.
Installing Microsoft.Extensions.Logging.Abstractions 1.1.0.
Installing Microsoft.Extensions.Options 1.1.0.
Installing Microsoft.AspNetCore.HttpOverrides 1.1.0.
Installing Microsoft.AspNetCore.Server.IISIntegration 1.1.0.
Writing lock file to disk. Path: D:\home\site\repository\obj\project.assets.json
Restore completed in 18.69 sec for D:\home\site\repository\Blogg.csproj.
Restoring packages for D:\home\site\repository\Blogg.csproj...
Restore completed in 14.38 sec for D:\home\site\repository\Blogg.csproj.
Restoring packages for D:\home\site\repository\Blogg.csproj...
Restore completed in 17.49 sec for D:\home\site\repository\Blogg.csproj.
NuGet Config files used:
D:\local\AppData\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
Installed:
14 package(s) to D:\home\site\repository\Blogg.csproj
Microsoft (R) Build Engine version 15.1.545.13942
Copyright (C) Microsoft Corporation. All rights reserved.
Blogg -> D:\home\site\repository\bin\Release\netcoreapp1.0\Blogg.dll
No executable found matching command "dotnet-publish-iis"
D:\home\site\repository\Blogg.csproj(30,5): error MSB3073: The command "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" exited with code 1.
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\Blogg.csproj" --output "D:\local\Tempd4ac97ca692979" --configuration Release
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu.60524.2862\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"`
在 ASP.NET 核心 Web 应用程序中使用 csproj
文件时,您可以安全地删除此行:
<Exec Command="dotnet publish-iis …" />
对于基于 project.json 的项目,如果您的项目使用 web sdk,此命令执行现在默认执行的操作:
<Project Sdk="Microsoft.NET.Sdk.Web">
看起来迁移正确地删除了对 dotnet-publish-iis
工具的工具引用,但没有删除相应的调用。您可以使用原始 project.json 文件在 dotnet migrate
tool's GitHub repository 提交问题。
我在通过 git 部署到 Azure 时遇到问题。当 PostCompile
命令在应用程序发布到服务器后运行时,我的名为 Blogg
的应用程序一直挂起。该命令是:
<Exec Command="dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" />
我的印象是这个命令的包引用来自 Microsoft.AspNetCore.Server.IISIntegration
但即使在添加版本 1.1.0-preview4-final
和 1.1.2
(最新)之后,我仍然有烦恼。
如果有用,下面是我的 .csproj 文件中的内容:
`<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.sqlserver.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild2-final" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot/*" CopyToPublishDirectory="Always" />
<None Include="Views/*" CopyToPublishDirectory="Always" />
<None Include="web.config" CopyToPublishDirectory="Always" />
</ItemGroup>
<Target Name="MyPostCompileTarget" AfterTargets="Publish">
<Exec Command="dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" />
</Target>
</Project>`
我从 Azure 日志中得到的错误:
`Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restoring packages for D:\home\site\repository\Blogg.csproj...
D:\Program Files (x86)\dotnet\sdk.0.0-rc4-004771\NuGet.targets(97,5): warning : Dependency specified was Microsoft.AspNetCore.Server.IISIntegration (>= 1.1.0-preview4-final) but ended up with Microsoft.AspNetCore.Server.IISIntegration 1.1.0. [D:\home\site\repository\Blogg.csproj]
Installing Microsoft.AspNetCore.Http.Features 1.1.0.
Installing Microsoft.AspNetCore.Hosting.Server.Abstractions 1.1.0.
Installing Microsoft.Extensions.Configuration.Abstractions 1.1.0.
Installing Microsoft.AspNetCore.Http.Abstractions 1.1.0.
Installing Microsoft.AspNetCore.WebUtilities 1.1.0.
Installing Microsoft.Extensions.ObjectPool 1.1.0.
Installing Microsoft.Net.Http.Headers 1.1.0.
Installing Microsoft.AspNetCore.Http.Extensions 1.1.0.
Installing Microsoft.AspNetCore.Hosting.Abstractions 1.1.0.
Installing Microsoft.AspNetCore.Http 1.1.0.
Installing Microsoft.Extensions.Logging.Abstractions 1.1.0.
Installing Microsoft.Extensions.Options 1.1.0.
Installing Microsoft.AspNetCore.HttpOverrides 1.1.0.
Installing Microsoft.AspNetCore.Server.IISIntegration 1.1.0.
Writing lock file to disk. Path: D:\home\site\repository\obj\project.assets.json
Restore completed in 18.69 sec for D:\home\site\repository\Blogg.csproj.
Restoring packages for D:\home\site\repository\Blogg.csproj...
Restore completed in 14.38 sec for D:\home\site\repository\Blogg.csproj.
Restoring packages for D:\home\site\repository\Blogg.csproj...
Restore completed in 17.49 sec for D:\home\site\repository\Blogg.csproj.
NuGet Config files used:
D:\local\AppData\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
Installed:
14 package(s) to D:\home\site\repository\Blogg.csproj
Microsoft (R) Build Engine version 15.1.545.13942
Copyright (C) Microsoft Corporation. All rights reserved.
Blogg -> D:\home\site\repository\bin\Release\netcoreapp1.0\Blogg.dll
No executable found matching command "dotnet-publish-iis"
D:\home\site\repository\Blogg.csproj(30,5): error MSB3073: The command "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" exited with code 1.
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\Blogg.csproj" --output "D:\local\Tempd4ac97ca692979" --configuration Release
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu.60524.2862\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"`
在 ASP.NET 核心 Web 应用程序中使用 csproj
文件时,您可以安全地删除此行:
<Exec Command="dotnet publish-iis …" />
对于基于 project.json 的项目,如果您的项目使用 web sdk,此命令执行现在默认执行的操作:
<Project Sdk="Microsoft.NET.Sdk.Web">
看起来迁移正确地删除了对 dotnet-publish-iis
工具的工具引用,但没有删除相应的调用。您可以使用原始 project.json 文件在 dotnet migrate
tool's GitHub repository 提交问题。