asp.net-core - dotnet 包在 .net 核心 mvc 应用程序中不起作用

标签 asp.net-core asp.net-core-mvc

我尝试使用 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/

相关文章:

node.js - 如何在 ASP.Net Core Web 项目中从 TypeScript 引用 Node 模块

asp.net - Identity 3.0中如何获取当前UserId? User.GetUserId 返回 null

asp.net - 找不到与命令 dotnet-projectmodel-server 匹配的可执行文件

.net-core - 创建一个包含 3 个表中的列的 View

entity-framework - 如何建立一对多关系的中间表?

asp.net - 迁移到 ASP.NET Core 1 后 Controller 无法工作

asp.net-core-mvc - 更新 ContextModelSnapshot EF Core

c# - ASP.NET Core 1.0 RC2 中的 "The type or namespace name could not be found"

c# - 如何在 ASP.NET Core 6 MVC 中创建 Startup 类

c# - 如何从 body 接受 API Controller 方法中的 List<string> 作为 json?