Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Visual Studio Code doesn't add CSS Stylesheets and JS-Files to HTML code

I migrated my project from Visual Studio Enterprise to Visual Studio Code and now my CSS and JS-Files are not being embedded in the HTML-File anymore. There are no error-messages. I think the problem is, that VS sees the links as webpages on my website and searches for them and doesn't find them. I come to this conclusion because of the messages in the debug console.

My code looks like this:

@model LoginModel;
@{
    ViewData["Title"] = "Home Page";
 }
<head>
    <link   rel="stylesheet" href="../wwwroot/css/Home.css"
      type="text/css" />
    <link rel="stylesheet" href="../wwwroot/css/overview.css"
       type="text/css" />

</head>
<body>
      **more HTML code here **
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="${workspaceFolder}/NXM_Web_Client/wwwroot/js/login.js"></script>

The Debug console states that:

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:5000/wwwroot/css/Home.css
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 21.0984ms 404 info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:5000/${workspaceFolder}/NXM_Web_Client/wwwroot/js/login.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 0.2092ms 404

The same message comes for all CSS and JS files. I allready tried marking the files as static, this didn't work.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Make sure that your files are in same folder where you have saved your main html file.Just tell me after trying did it worked.

about 4 years ago · Juan Pablo Isaza Report

0

While ../ in a URL means "Go to the parent segment of the path", you can't go above the server root.

wwwroot is the root.

You are trying to go from / to a level above / (which is impossible) and then back into / which leaves you in /wwwroot.

Don't do that.

Either use a relative path which doesn't go past the root (css/Home.css) or use an absolute path which starts at the root (/css/Home.css).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!