Skip to content

Unexpected BLAZOR106 error when adding static script files to razor pages project #57324

Open
@rhuebner76

Description

@rhuebner76

Is this a Bug or Feature request?:

Bug

Steps to reproduce:

  1. Create new razor pages project, for example
dotnet new razor
  1. Add a file named with the extension: *.cshtml.js (e.g., index.cshtml.js) into the wwwroot directory.
  2. Build

Description of the problem:

Prior to net6 several web projects were setup to use generating cshtml page javascript using typescript. To keep files together and use the VS file nesting feature typescript files were named with the corresponding page filename (e.g., index.cshtml.ts) which would output index.cshtml.js.

Expected behavior:
No errors

Actual behavior:
Results in a build error BLAZOR106 associated with the static file

error BLAZOR106: The JS module file '..\wwwroot\Index.cshtml.js' was defined but no associated razor component or view was found for it.

Logs

OmniSharp

No OmniSharp, using C# DevKit

Razor

Expand

[Client - 7:58:23 AM] -- Starting Issue Data Collection-- 
[Client - 7:58:34 AM] -- Stopping Issue Data Collection-- 

Workspace information

Razor document:

Expand

Non Razor file as active document

Projected CSharp document:

Expand

Could not determine CSharp content

Projected Html document:

Expand

Could not determine Html content

Machine information

VSCode version: 1.92.0
Razor.VSCode version: 2.39.29

dotnet --info

Expand

.NET SDK:
 Version:           8.0.303
 Commit:            29ab8e3268
 Workload version:  8.0.300-manifests.34944930
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.303\

.NET workloads installed:
 [aspire]
   Installation Source: VS 17.10.35122.118
   Manifest Version:    8.0.0/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json
   Install Type:              Msi

 [wasm-tools]
   Installation Source: VS 17.10.35122.118
   Manifest Version:    8.0.7/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.current\8.0.7\WorkloadManifest.json
   Install Type:              Msi


Host:
  Version:      8.0.7
  Architecture: x64
  Commit:       2aade6beb0

.NET SDKs installed:
  5.0.416 [C:\Program Files\dotnet\sdk]
  7.0.203 [C:\Program Files\dotnet\sdk]
  8.0.107 [C:\Program Files\dotnet\sdk]
  8.0.303 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Extensions

Expand

Extension Author Version
azure-account ms-vscode 0.12.0
azure-pipelines ms-azure-devops 1.228.0
cmake twxs 0.0.17
cmake-tools ms-vscode 1.18.44
cpptools ms-vscode 1.21.6
cpptools-extension-pack ms-vscode 1.3.0
cpptools-themes ms-vscode 2.0.0
csdevkit ms-dotnettools 1.9.55
csharp ms-dotnettools 2.39.29
data-workspace-vscode ms-mssql 0.5.0
dotnet-interactive-vscode ms-dotnettools 1.0.5229040
EditorConfig EditorConfig 0.16.4
hexeditor ms-vscode 1.10.0
jupyter ms-toolsai 2024.7.0
jupyter-keymap ms-toolsai 1.1.2
jupyter-renderers ms-toolsai 1.0.19
latex-workshop James-Yu 10.1.0
lit-html bierner 1.11.1
live-server ms-vscode 0.4.14
LiveServer ritwickdey 5.7.9
makefile-tools ms-vscode 0.10.25
markdown-mermaid bierner 1.23.1
mssql ms-mssql 1.23.0
nightwatch browserstackcom 1.0.1
ooxml-extension-pack mikeebowen 1.0.2
ooxml-validator-vscode mikeebowen 1.5.4
ooxml-viewer yuenm18 2.0.1
powershell ms-vscode 2024.2.2
prettier-vscode esbenp 10.4.0
remote-containers ms-vscode-remote 0.380.0
remote-wsl ms-vscode-remote 0.88.2
sql-bindings-vscode ms-mssql 0.4.0
sql-database-projects-vscode ms-mssql 1.4.3
volar Vue 2.0.8
vscode-azureresourcegroups ms-azuretools 0.9.1
vscode-bicep ms-azuretools 0.29.47
vscode-coverage-gutters ryanluker 2.11.1
vscode-docker ms-azuretools 1.29.1
vscode-dotnet-runtime ms-dotnettools 2.1.1
vscode-drawio hediet 1.6.6
vscode-eslint dbaeumer 3.0.10
vscode-jest Orta 6.2.5
vscode-jupyter-cell-tags ms-toolsai 0.1.9
vscode-jupyter-slideshow ms-toolsai 0.1.6
vscode-markdown-ide kevgo 0.4.3
vscode-typescript-next ms-vscode 5.6.20240812
vscode-xml redhat 0.27.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesuntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions