admin管理员组

文章数量:1122832

Downloaded latest stable version of aspnetboilerplate,

Installed client libraries using libman.json restore,
getting following strange errors on very first build

  1. InvalidOperationException
  2. Expected Identifier

System.InvalidOperationException: No file exists for the asset at either location 'wwwroot\view-resources\Views\Account\Login.min.js' or 'wwwroot\view-resources\Views\Account\Login.min.js'.
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ComputeFingerprintAndIntegrity(String identity, String originalItemSpec)
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute()

Expected identifier: . \wwwroot\view-resources\Views\_Bundles\shared-layout.min.js

Expected expression: . \wwwroot\view-resources\Views\_Bundles\shared-layout.min.js

actually wwwroot\view-resources\Views\Account\Login.min.js this file exists

Downloaded latest stable version of aspnetboilerplate,

Installed client libraries using libman.json restore,
getting following strange errors on very first build

  1. InvalidOperationException
  2. Expected Identifier

System.InvalidOperationException: No file exists for the asset at either location 'wwwroot\view-resources\Views\Account\Login.min.js' or 'wwwroot\view-resources\Views\Account\Login.min.js'.
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ComputeFingerprintAndIntegrity(String identity, String originalItemSpec)
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute()

Expected identifier: . \wwwroot\view-resources\Views\_Bundles\shared-layout.min.js

Expected expression: . \wwwroot\view-resources\Views\_Bundles\shared-layout.min.js

actually wwwroot\view-resources\Views\Account\Login.min.js this file exists

Share Improve this question edited Jan 1 at 20:56 Mikhail 9,2874 gold badges34 silver badges51 bronze badges asked Dec 20, 2024 at 5:08 Nitin SNitin S 7,53210 gold badges61 silver badges102 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The CS0006 error (the last one illustrated in the Error tool window) is pretty generic error. While it may be also useful to search for other its possible causes,

getting following strange errors on very first build

this fact often indicates the obj folder simply cannot be created (most likely because of the file system permissions' issues), while subsequent attempts are fine. The remaining build errors look consequent of this one.

To check this assumption, do the following:

  • Download a brand new archive with a template;
  • Extract it into a some subdir (for further experiments) and ensure the everyone / full control permissions on the created / extracted directory;
  • Make sure that you open sln with the Visual Studio at least Pro (in addition to the folders' permissions, sometimes such the error may occur when using Visual Studio Community Edition), better under the Administrator privileges;
  • Build / Rebuild to check if it is ok after the proposed settings during the first build.
  • If not, ensure the same permissions settings on bin / obj folder of the stratup / entry point ASP.NET Core proj and try again.

UPDATED #1:

CS0006 is occuring because shared-layout.min.js is not generating

It appears that the problem is in any of inputs (may be any is malformed, or/and cannot be minified). Try to remove certain files from the "inputFiles" source to determine the problematic one:

bundleconfig.json:

{
  "outputFileName": "wwwroot/view-resources/Views/_Bundles/shared-layout.min.js",
  "inputFiles": [
    "wwwroot/libs/jquery/jquery.js",
    ...
  ]
},

UPDATED #2:

at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ComputeFingerprintAndIntegrity(String identity, String originalItemSpec) at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute()

Note that net9 has some known issues related to StaticWebAssets. Check if this works under the v8x / net8 cfg.

本文标签: aspnet coreaspnetboilerplate InvalidOperationExceptionStack Overflow