简体   繁体   English

Asp.Net Core Javascript无法与Razor一起使用

[英]Asp.Net Core Javascript not working with Razor

I'm having trouble with an javascript file on ASP .NET Core 2.0. 我在ASP .NET Core 2.0上遇到了javascript文件的问题。 I'm doing a course to learn ASP .NET Core, and my javascript file doesn't wants to work, I don't know why, it doesn't appears on network and it doesn't shows any console.log that I try to use. 我正在做一门学习ASP .NET Core的课程,我的javascript文件不想工作,我不知道为什么,它没有出现在网络上,也没有显示任何console.log,尝试使用。

The file is located at wwwroot/js and I have the @section with the script included on the view. 该文件位于wwwroot / js,我在视图中包含@section和脚本。 I already compared my code with the final project and there's nothing wrong. 我已经将我的代码与最终项目进行了比较,没有错。

What I've tried so far is: resetting browser cache, putting the script on the layout.cshtml, but no results. 到目前为止,我已经尝试过:重置浏览器缓存,将脚本放在layout.cshtml上,但是没有结果。 I also tried to do some other stuff that I found here and nothing worked. 我还尝试做一些我在这里找到的东西,但没有任何效果。

Okay, I fixed my problem, the issue was happening because there were 2 csproj on the same folder, and I was running the one without the javascript file, what a dumb mistake. 好的,我解决了我的问题,这是因为同一文件夹上有2个csproj,而我正在运行的却没有javascript文件的问题,这真是一个愚蠢的错误。 Thanks for everyone that tried to help me anyway. 谢谢所有试图帮助我的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM