Project.json
Use of project.json is to store metadata ,compilation information and project dependencies. It is replacement of ASP.NET 5 package.config and we store all the package information whichwe want to use in our application . we use JSON notation to feed all required things. which is nothing just a key value pairs. For example
“key”:value
I am going to discuss about all important or basic attributes of this file
- Dependencies
“dependencies”: {
“Microsoft.NETCore.App”: {
“version”: “1.0.0”,
“type”: “platform”
},
“Microsoft.AspNetCore.Diagnostics”: “1.0.0”,
“Microsoft.AspNetCore.Server.IISIntegration”: “1.0.0”,
“Microsoft.AspNetCore.Server.Kestrel”: “1.0.0”,
“Microsoft.Extensions.Logging.Console”: “1.0.0”
},
Dependencies are very important factor in case of asp.net application execution. All the dependencies information is updated into this file whenever we install any package from nuget package manager. It will store complete information of package like version and type etc.
- Tools:
“tools”: {
“Microsoft.AspNetCore.Server.IISIntegration.Tools”: “1.0.0-preview2-final”
},
Tools are the object which are used during the compilation or in application build process but at runtime tools are not used .please note down one things that these are the tools not the references.
- Frameworks
“frameworks”: {
“netcoreapp1.0”: {
“imports”: [
“dotnet5.6”,
“portable-net45+win8”
]
}
},
ITW includes information about Dot Net Framework which we are going to use into our current application actually we have two types of Dot Net Application first applications which are posted on the windows platform only that condition we can use Framework 4.5 4.6 and this application use Dot Net Framework CLR but if you want to who’s Java application on Windows Linux on a platform so that time we will take Dot Net core framework
- buildOptions
“buildOptions”: {
“emitEntryPoint”: true,
“preserveCompilationContext”: true
},
This object is used to store all compilation aspects.
emitentrypoint is used to tell compiler that this current project is a application not a library or we can say that this application having the main function(public static void main)
preserveCompilationContext is to Help in running of razor views.
- runtimeOptions
“runtimeOptions”: {
“configProperties”: {
“System.GC.Server”: true
}
},
Specifies parameters to be provided to the runtime during initialization.
configProperties
This object Contains configuration properties to configure the runtime and the framework.
“System.GC.Server”: true
It Will enable the garbage collection at server side,by default it is false.
- Publishoptions
“publishOptions”: {
“include”: [
“wwwroot”,
“web.config”
]
},
An object containing properties for compilation configuration.We can include and exclude compilation build properties.Exclude property is used to prevent build or compilation of particular object like bin directory.
- Scripts
“scripts”: {
“postpublish”: [ “dotnet publish-iis –publish-folder %publish:OutputPath% –framework %publish:FullTargetFramework%” ]
}
An object that defines scripts run during the build process. Each key in this object identifies where in the build the script is run. Each value is either a string with the script to run or an array of strings containing scripts that will run in order.