ASP.NET Core Solution Tree
In the last few weeks I’ve started to look at ASP.NET Core. There are lots of differences to the ASP.NET we have now - the one that hit me straight away was the solution tree …
global.json
In short, this is used to define all the projects in the solution. In the example below, two projects are defined for the main source code and the unit tests.
wwwroot
This is a new folder and it is where you should put all files that need to be served. So, for example, static HTML files would go in this folder. Your source code, on the other hand, wouldn’t go in this folder. I quite like this - it gives a nice separation between your source code and the stuff that needs to be served.
References
This node in the solution tree exists in v4.x and v5 and the purpose is the same - to show the .NET references. However, v5 shows the references in a hierarchical format:
project.json
project.json contains a lot of the stuff that used to be in web.config.
In the screenshot above:
- webroot allows you to rename the webroot node within the tree
- version is the version of the app / component
- dependencies are the .NET dependencies in the project
- frameworks are what framework compilations need to be done
- bundleExclude are the folders to exclude during the bundling process
- exclude are the folders to exclude during the publishing process
This wiki details more options that are available in project.json.
config.json
config.json contains app settings like the database connection string.
By default, when you create a blank project, config.json is not included. However, you can add it by selecting “ASP.NET Configuration File” when you add a new item to the project.
Startup.cs
Startup.cs replaces Application_Start() in Global.asax and allows you to set up dependent services when the app boots up.
If you to learn about using React with ASP.NET Core you might find my book useful: