Reputation: 3508
I am trying to create a new web application using OS X and VS Code from scratch without using any scaffolding tool. My starting point is Scott Allen's tutorial on pluralsight:
https://app.pluralsight.com/library/courses/aspdotnet-core-1-0-fundamentals/table-of-contents
My project structure is:
The global.json
file contains
{
"projects": [ "src" ],
"sdk": {
"version": "1.0.0-rc1-update2"
}
}
And the project.json
currently contains
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": false
},
"dependencies": {
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000"
},
"exclude": [
"wwwroot",
"node_modules"
]
}
I have run dnu restore
to get the packages and now I would like to run the web. I need to go to the web app folder and run dnx web
in order to do so and the app starts
Is it possible to run the application directly from the root folder, not from the web app folder? Is the global.json
file needed in such setup? And how do I change the hosting environment? I have gone through the documentation, but the hosting environment is only clear when using VS 2015.
Upvotes: 0
Views: 126
Reputation: 28425
You cannot simply run from the root because there could be multiple projects that are "executable". But you can pass the project to dnx using the --project/-p
argument.
The environment is set using the ASPNET_ENVIRONMENT
environment variable.
The global.json file is useful for two things:
sdk
section is only by VS.projects
section is used all the time and it's useful if you have the projects in multiple folders (for example src
and test
). If everything is in a single folder, you don't need it.So, the bare minimum in order to run an web application is:
Upvotes: 1