我尝试使用 bundleconfig.json,这是我在启动项目时标准添加到项目中的。我读了他们说你必须跑的每一个地方
dotnet bundle
但这对我不起作用我得到了错误
No executable found matching command "dotnet-bundle"
现在我谷歌了一下,发现我必须在 Project.json 中添加这个
"tools": {
"BundlerMinifier.Core": "2.2.281",
但我没有 Project.json 文件只有 csproj。我以为我必须安装包。所以我安装了 BundlerMinifier.Core 但仍然出现同样的错误。
我必须做什么才能运行代码并捆绑我的文件?
最佳答案
根据 https://learn.microsoft.com/en-us/aspnet/core/client-side/bundling-and-minification?view=aspnetcore-2.1&tabs=netcore-cli%2Caspnetcore2x您必须为 dotnet 安装 CLI 工具才能执行此操作。
从项目目录中的命令行看起来您是这样做的:
dotnet add package BuildBundlerMinifier
dotnet build
你应该得到这个结果
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Bundler: Begin processing bundleconfig.json
Bundler: Done processing bundleconfig.json
BuildBundlerMinifierApp -> C:\BuildBundlerMinifierApp\bin\Debug\netcoreapp2.0\BuildBundlerMinifierApp.dll
链接页面还讨论了临时捆绑。它在 Microsoft 站点上,所以它不应该去任何地方。
关于asp.net-core - dotnet 包在 .net 核心 mvc 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47717646/