Search code examples
angular.net-coreangular-clidotnet-cli

An efficient way of DotNetCore 2.0 and Angular Project Structure


I wanted to know your professional opinions about the project files/folders structure. Dotnet-cli gives us a ClientApp folder that contains only client-side codes. Which is nice. However, it does not provide separate server-side codes. All the server-side codes are inside the main directory. I found this not efficient. I made a separate folder called "server" and put all server-side codes in it. And, I made 'client" folder and place all the client-side code in it. It worked fine with very small extra coding and I think it is more efficient in terms of engineering perspective. What do you all think? Should I use whatever dotnet-cli gives me or use the approach above? One of the advantages of having server-client separate is to use angular-cli. Starting from dotnetcore 2.0, it's hard to use angular-cli. On the other hand, this case you'll have to run server and client separately.

Thanks!


Solution

  • If you use Visual Studio Code, you are free to use any directory structure. You coordinate everything yourself.

    If you use Visual Studio 2017, it has a built-in support for ASP.NET Core projects and it uses a kind of "convention over configuration" approach. That support is enabled by including <Project Sdk="Microsoft.NET.Sdk.Web"> in the project file.

    VS2017 has a built-in support for npm and package.json as well. It expects the node_modules folder under the root folder. If that folder is moved deeper, VS thinks that it is a regular project folder, and enumerates all the npm files. That takes long time, so the IDE gets effectively frozen.