在WebDeploy for ASP.NET Core期间找不到匹配命令“dotnet-bundle”的可执行文件

问题描述 投票:27回答:3

我是ASP.NET的新手,我正在尝试发布一个Web应用程序。我尝试过使用2个不同的主机进行Web部署,但不断收到错误: -

找不到匹配命令“dotnet-bundle”的可执行文件

这有什么关系?

Project.Json

{
"dependencies": {
"Bitly.Net": "0.0.6",
"BitlyAPI": "1.0.3",
"BundlerMinifier.Core": "2.2.281",
"Common.Logging": "3.4.0-Beta2",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Parse": "1.7.0",
"Spring.Social.Twitter": "2.0.0-M1",
"Stormpath.AspNetCore": "0.7.0"
},

"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},

"frameworks": {
"net46": {
  "frameworkAssemblies": {
  }
}
},

"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},

"publishOptions": {
"include": [
  "wwwroot",
  "**/*.cshtml",
  "appsettings.json",
  "web.config"
]
},

"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"userSecretsId": "aspnet-ParseAppDashboard-20161008081***"
}
asp.net-core asp.net-core-mvc webdeploy
3个回答
54
投票

在Project.json的工具部分添加此 -

  "tools": {
    "BundlerMinifier.Core": "2.2.281",
    ....

在保存Project.json时,VS2015会自动恢复包。

如果它不起作用,则右键单击项目并单击“还原包”选项。

如果这不起作用,请尝试使用dotnet restore CLI命令进行恢复。

看看这是否有帮助。


30
投票

自2016年底(RC3及更高版本,VS2017及更高版本)移至.csproj文件格式后,添加

<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.6.375" />

<ItemGroup>

<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">

  ...

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.6.375" />
  </ItemGroup>
</Project>

或者为你的<ItemGroup>设置创建一个新的DotNetCliToolReference(你可以有很多)。

但请查看https://www.nuget.org/packages/BundlerMinifier.Core获取最新版本号


2
投票

您可能还需要添加

"runtimes": {
"win10-x64": {}
},

如果你想升级到核心1.1(也改成global.json文件中正确的运行时)你的project.json我说这是因为我在VS2015中将我的包和应用程序升级到1.1后出现了包错误。

© www.soinside.com 2019 - 2024. All rights reserved.