Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# ASP.NET MVC Basics Views View Layouts

ASP.Net Core Website Files

OK, so I'm on a Mac, and I'm trying to complete this track using ASP.Net Core MVC rather than any of the ASP.Net 4.x releases.

Everything was functioning smoothly, except for now. I can't get it to render the site properly. It looks like a CSS error to me. I'm getting the layout because I get the footer and if I inspect it I can see the header calls to the css files, but the styling is not showing up. I double checked my _Layout.cshtml file and the path to the CSS file is correct, the reference to modernizr looks correct. I should not here I pulled the css, js, and images files out of wwwroot file that ASP.Net Core Generates, so that the paths from the treehouse files are all correct, but I'm still having issues. I get this is kind of unconventional since I'm asking about something this course doesn't cover verbatim.

Thanks for any help.

Steven Parker
Steven Parker
231,110 Points

This is certainly not the most unconventional question asked in the forum, even just this week!

But you'll probably need to share your repo and/or the URL of a live test site to give folks a chance to help out.

3 Answers

Well, I figured it out.

For all future users trying to do this with .Net Core, .Net Core has all of your static files in the wwwroot folder when the site is originally generated. If you want, you CAN change the name of the directory using the app.UseStaticFiles(new StaticFileOptions()) method in your startup.cs file. I'm leaving mine alone.

When you download the aspnet-mvc-basics-design-files.zip with the css, js, and image files, unzip the folder instead of placing the Content, Scripts, and Images folders in the root of your project, you just drop them in the wwwroot directory, and then all the references in the cshtml files should load properly.

Steven Parker
Steven Parker
231,110 Points

Congrats on resolving your own issue! :+1:

Thank you! I had the same problem and your solution helped!

Hi Steven, Thank you! Here's a link to GitHub

https://github.com/JD-Sp/ComicBookGallery/tree/master/ComicBookGallery

also, if I go into Inspect in Safari, and I look at the resources, it says there was trouble loading site.css, bootstrap.min.css, and the modernizr, jquery, and bootstrap js files. So I think this is the Core (pun intended) of my problem.

Daniel Antonov
Daniel Antonov
2,735 Points

Thanks, you saved me some time :)))