Create an ASP.NET Core Application Part II

This post is part of a series

In the part I of this post, you can see how to create an ASP.NET Core application using Visual Studio 2019. We will continue the topic in this post.

We left off the last post with a teaser for a very important folder in ASP.NET Core Web Application development. Here is an expanded view of that folder.

Notice that the “wwwroot” folder doesn’t even use the folder icon. Instead it uses the universal web icon to show its distinct purpose. This is the folder that will hold all of your static client-side assets. This is where you will put your client-side code (JavaScript) and your styles (CSS). You can also add libraries to your “lib” folder to make files available offline during development. For example, with the default template, the styles and code files are automatically added for the following:

  • bootstrap
  • jquery
  • jquery-validation
  • jquery-validation-unobtrusive

If you don’t want to use these extra libraries, no problem — just delete them from the lib folder.

If you want to add new libraries, click on the project and select “Manage Client-Side Libraries”

Static files are accessible via a path relative to the web root. For example, the Web Application project template contains several folders within the wwwroot folder:

  • wwwroot
    • css
    • images
    • js

The easiest way to add a static resource to your page is to drag it from the solution explorer into the <head> section of your page. For styles, it will automatically create a relative link to the css file. For JavaScript, it will create a script tag.

In Part III of this post, I will discuss Partials and Pages.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close