gpt4 book ai didi

c# - .NET Core2.0 bundleconfig.json 不工作

转载 作者:太空狗 更新时间:2023-10-29 17:34:47 25 4
gpt4 key购买 nike

我正在努力尝试让 bundle 在 Core 2.0 网络应用程序中工作。我的 bundleconfig.json 文件中有以下内容:

[
{
"outputFileName": "wwwroot/css/site.min.css",
"inputFiles": [
"wwwroot/css/site.css"
]
},
{
"outputFileName": "wwwroot/css/bootstrap.min.css",
"inputFiles": [
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
]
},
{
"outputFileName": "wwwroot/css/jquery-datatables.min.css",
"inputFiles": [
"wwwroot/lib/jquery/jquery-datatables/datatables.css",
"wwwroot/lib/jquery/jquery-datatables/Responsive-2.2.1/css/responsive.dataTables.css"
]
},
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/site.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
},
{
"outputFileName": "wwwroot/js/jquery.min.js",
"inputFiles": [
"wwwroot/lib/jquery/dist/jquery.js",
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
},
{
"outputFileName": "wwwroot/js/bootstrap.min.js",
"inputFiles": [
"wwwroot/lib/bootstrap/dist/js/bootstrap.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
},
{
"outputFileName": "wwwroot/js/jquery-datatables.min.js",
"inputFiles": [
"wwwroot/lib/jquery/jquery-datatables/datatables.js",
"wwwroot/lib/jquery/jquery-datatables/Responsive-2.2.1/js/dataTables.responsive.js"
],
"minify": {
"enabled": true,
"renameLocals": true
},
"sourceMap": false
}
]

我安装了 BuildBundlerMinifier NugGet 包。当我构建项目时,我看到正在处理 bundleconfig.json 文件。
我将以下内容添加到 _Layout.cshtml:

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<environment include="Development,Staging,Production">
<link rel="stylesheet" href="~/wwwroot/css/site.min.css" />
<link rel="stylesheet" href="~/wwwroot/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/wwwroot/css/jquery-datatables.min.css" />
</environment>
</head>
<body>
<environment include="Development,Staging,Production">
<script src="~/wwwroot/js/site.min.js"></script>
<script src="~/wwwroot/js/jquery.min.js"></script>
<script src="~/wwwroot/js/bootstrap.min.js"></script>
<script src="~/wwwroot/js/jquery-datatables.min.js"></script>
</environment>
@RenderSection("Scripts", required: true)
</body>

当我运行应用程序时,没有加载资源。我收到以下错误:

Loading failed for the <script> with source “https://localhost:44301/wwwroot/js/site.min.js”.
Loading failed for the <script> with source “https://localhost:44301/wwwroot/js/jquery.min.js”.
Loading failed for the <script> with source “https://localhost:44301/wwwroot/js/bootstrap.min.js”.
Loading failed for the <script> with source “https://localhost:44301/wwwroot/js/jquery-datatables.min.js

有人可以帮帮我吗?

最佳答案

我厌倦了 Nuget 包管理器,但它不起作用,然后卸载它,

已解决:

打开 Nuget 包管理器控制台

Install-Package BuildBundlerMinifier -Version 2.8.391 

并再次重建解决方案。它对我有用。

关于c# - .NET Core2.0 bundleconfig.json 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48720712/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com