Skip to content

Blazor project not recognizing co-located JavaScript file #63543

@divvjson

Description

@divvjson

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a Counter component where I would like to co-locate JavaScript.

When I add the JavaScript file (Counter.razor.js) it is not recognized as being co-located with Counter.razor.

Not working:
Image
However, in another project I have it seems to work fine:
Image

What makes this work, and what makes it break? I'm curious.

Expected Behavior

Visual Studio / Blazor should recognize a co-located JavaScript file if it's placed in the same directory with the same name + .js file extension.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

9.0.304

Anything else?

Microsoft Visual Studio Community 2022
Version 17.14.13 (August 2025)
VisualStudio.17.Release/17.14.13+36414.22.-august.2025-
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

ASP.NET and Web Tools 17.14.122.59099
ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.14.122.59099
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 17.14.122.59099
Azure Functions and Web Jobs Tools

C# Tools 4.14.0-3.25412.6+c167adef821b9ba2f1c44c227a5e79ca11876461
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

CreateLayoutWizard 1.0
Create layout wizard.

DevExpress Reporting Extension 1.5.24203
A Visual Studio extension that invokes the Report Designer editor for report definition VSREPX files.

DevExpress Reporting Tools Extension 1.0
Extends Visual Studio with tools required for the Report Designer editor.

DevExpress VSDesigner NETFramework Package 1.0
A Visual Studio extension that invokes the Report and Dashboard designer editors.

DevExpress.DeploymentTool 1.0
A useful tool for deploying DevExpress assemblies.

GitHub Copilot 17.14.1091.29919
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio 17.14.11 (f3bc644800)
Support for debugging Mono processes with Visual Studio

NuGet Package Manager 6.14.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core) 17.14.3.2530601+3372435431977e91904a23ceb1eab689badc1bd9
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 17.14.26.0
Microsoft SQL Server Data Tools

Tailwind CSS VS2022 Editor Support 1.12.3
Unofficial VS2022 Tailwind CSS extension for IntelliSense, linting, sorting, and more.

TypeScript Tools 17.0.40502.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.14.0-3.25412.6+c167adef821b9ba2f1c44c227a5e79ca11876461
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.14.0-beta.25230.7+c1a9d78ad4a474a716ccffb4367ed5151e3f7c9f
Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin 17.14.271 (bf42fb0072)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.14.3.0 (tags/main-61034a2(11307611)^0@61034a2622)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions