dotnet / dotnet/aspnetcore

Rebuild Fails in ASP.NET Project Using .NET Core 6.0 When Using bundleconfig.json, but Clean and Build Succeed

Open
#59,475 8 comments 3 reactions 0 assignees View on GitHub
area-mvc Author: Migration Bot :robot: Needs: Attention :wave: Needs: Repro
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/Rebuild-Fails-in-ASPNET-Project-Using-/10802793)._

---
[severity:It's more difficult to complete my work]
In Visual Studio 2022, when attempting to rebuild an ASP.NET project that uses .NET Core 6.0 and bundleconfig.json, the rebuild process fails. However, performing a separate **clean** operation followed by a **build** works as expected. This behaviour suggests an issue with how Visual Studio handles the rebuild process in projects with bundleconfig.json.

```
Severity Code Description Project File Line Suppression State
Error (active) System.InvalidOperationException: No file exists for the asset at either location 'wwwroot\bundle\js\<somefile>.js' or 'wwwroot\bundle\js\<somefile>.js'.
at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ComputeFingerprintAndIntegrity(String identity, String originalItemSpec)
at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute() WorkFlow.Web C:\Program Files\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.targets 662
```

**Steps to Reproduce:**
1. Open Visual Studio 2022 with an ASP.NET Core project targeting .NET Core 6.0.
1. Include a bundleconfig.json file in the project for bundling and minification.
1. Right-click the project in Solution Explorer and select Rebuild.

**Expected Behaviour:**
The rebuild operation should succeed without errors, just as performing a clean and build does.

**Actual Behaviour:**
The rebuild operation fails, often without clear explanation, while clean and build separately succeed.

**Steps Tried to Resolve**
1. Verified that bundleconfig.json is properly configured and valid.
1. Verified Visual Studio 2022 to the latest version (17.12.2).
1. Reproduced the issue on multiple machines and projects.

**Impact**
This issue disrupts the development workflow, as the **Rebuild** operation is commonly used for ensuring a clean and complete build without manual intervention.

Thank you for addressing this issue. Please let me know if additional logs or project files are required for further investigation.

---
### Original Comments

#### Feedback Bot on 12/2/2024, 04:00 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.