Publishing With DNU or DOTNET





5.00/5 (1 vote)
How to publish with DNU or DotNet
In this option, we will see how to host the site using DNU option. DNU means DOT NET Utility. DNU is part of the ASP.NET Core ecosystem. Therefore, when we type dnu in command prompt, then it will result in all the required options available as shown below:
One of the commands which do interest me is publish here. DNU is very useful, you can actually script all of these processes and you can actually install all the dependencies and then run the build and then publish to any server, say Test, Staging or even on Release server. Therefore, it provides a mechanism to automate these tasks. Here, we will be applying dnu command at the root of the project folder like shown below with output directory option.
Once the command starts executing, then you will see the below packages are getting copied.
Therefore, this command will run all the required pre-publish commands and will copy all the different pieces to the destination folder. Once, the command gets completed, then it will show similar message as follows.
Now, let us go to the destination folder.
This should look familiar to you as this is the same thing that we have seen in case of publish from Visual Studio. In fact, Visual Studio was just automating the stuff using DNU tool. Now, let us go inside the approot.
Therefore, here also runtime is embedded, now when I type web here, then it will launch the application as shown below:
And, here when I navigate to http://localhost:5000, it will present the same expected result.
Note: This piece is valid for RC1 update. However, if you have upgraded to RC2, then command dnx is renamed to dotnet. You can refer the complete list at https://docs.efproject.net/en/latest/miscellaneous/rc1-rc2-upgrade.html.
I hope you would have liked today’s discussion. Thanks for joining me.
Happy coding!
327 total views, 3 views today