Sunday 27 March 2016

ASP .NET 5 Web App Dev Thru VS Code

            Happy Holi to all you out there!! With this blog, let's move out from the conventional VS IDE to Visual Studio Code by developing a sample web app using ASP.NET 5. Before that How To Do? want to discuss with you about three concepts as an early bird to pick you up on the latest happening on ASP .NET.

I) Web Development under ASP.NET stack

Client Side Package Distribution – By this time, you all knew about the Nuget Package Manager / Console to get the packages. For example you need to use JSON serialiser, you don’t reinvent it, as its available in the NewtonSoft JSON., which you get from the NuGet Library. But now, the client packages., (for eg., getting of any js script plugins, etc.,) could be handled here after via Bower.

No Servers - Only Servlet (Threads) – Running your Web App under IIS local Manager / IIS Express bundled with VS., here after no need of debugging your web apps under those heavy servers, all that you need is to run your node (fork it!!).

II) ASP.NET 5
As discussed on my last blog, here is the difference in ASP.NET 4.6 and Core 1.0 is spotted out from the below image :


Which one to use? – ASP. Net 4.6 is matured platform, ready to production, consists of full framework’s capabilities. On other hand, Core 1.0 has got ASP.NET MVC and Web API right now.
World of Caution : Migration from 4.6 to 1.0 will include the tedious re-codes, still some of the base libraries were not included in the 1.0.

III) Pre - Requisites To Be Installed.

1.     Install VS Code from http://code.visualstudio.com/
2.     Install Node.js – from http://nodejs.org
3.     Install Git. – http://git-scm.com/downloads


Installed Visual Studio Code Window

STEP-1:

Enter the following command at your command prompt and do the system re-start.

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}"

STEP-2:

After the system re-boots., issue the below commands in command prompt.

dnvm upgrade        // to download DNX [.NET Execution Environment]

dnvm list                    // will list the details of the available run-times.

(dnvm stands for - dot net version manager)

STEP-3:

Install the following packages, from Command prompt :

Yeoman - http://yeoman.io/ - for application scaffolding
                            
                                              npm install -g yo

Grunt - http://gruntjs.com/ - javascript task runner.
                  
                                             npm install grunt

Bower - http://bower.io/ - Client side package manager.
                                       
                                  npm install generator-aspnet bower

STEP-4:

To Create the ASP.NET Web Application project:

yo asp.net          // the following welcome screen is shown

Welcome Screen, to choose your project template.
select the application type and give a name to your project., my current selection is given below in the image:

List of generated files for the MVC

Now, have created the project "HelloWorld" the bottom part of the above image, discussed about the other commands for you to work, with. 

[To move from the command prompt to Visual Studio Code. give: code . from the 

downloaded project location.]

STEP - 5

To run the web app locally, from the command palette of VS code., give 

dnx: Run command

followed by 
dnx web - (HelloWorld)

Open up a browser. and navigate to the url: http://localhost:5000


"HelloWorld" - App - Created.
For better images used in this blog, you can get it from here

Happy Configuring :)


Tuesday 22 March 2016

.NET Is Open Source Now.

      
     I think its right time, to restart my blog. Meanwhile, I gave Microsoft some time to standardize their frameworks (just kidding). Here I would like to sum up the recent & excited things happening over the so-called "Open Source .NET" world.

[PS. Don't conclude yourself as it's yet another blog of "What's New In Plate". But to explain about the real reason., behind their re-works. ]

Again, What's New In Plate ?
  • ASP.NET 5 is now ASP.NET Core 1.0
    • [Before ASP.NET 5 - the evolution order is ASP.NET 1.0, 2.0, 3.0, 4.0, 4.5 and now the current support version is 4.6]
  • .NET Core 5 is now .NET Core 1.0. 
    • [Previous releases were .NET 2.0, 3.0, 3.5, 4.0, 4.5 and 4.6]                                                                                                     
  • Entity Framework 7 is now Entity Framework Core 1.0 or EF Core 1.0 colloquially.
It's simply not an additional release, of the existing frameworks with few extra features, and fixes but it's  their struggle / defense to sustain in the industry. 


        If it's not breaking you down, it's not building you up.


Browser - War :

      Node, the popular JavaScript run-time, currently works only with Google’s V8 JavaScript engine. Hence the browser team made the Chakra JavaScript engine that powers both Edge and Internet Explorer open source. So NodeJS developers can have choice of picking up both chrome and Edge as their browser choice.

Universal Platform :

          To capture the Mobile market - Windows 10. Either Desktop, Tablet or Mobile, single OS serves the purpose, but the apps and their run-time??? Legacy .NET frameworks memory cost is much higher.,  hence, these core frameworks will serve the purpose. [FYI already companies like Xamarin - have their own CLR implementation]

Rise of Cloud :

     As of September 2015, around 20% of VM's running on Azure Iaas (Infrastructure As Service) is having Linux. To cope up the Linux platforms - Rewriting the system calls???) the frameworks needs to be restructured, hence like Java you can now use C# in Linux OS. (Yeaaahhhh, now you can use your favorite IDE : Visual Studio Code at your favorite Linux Flavors).

Lastly, in exact phrase as quoted by Jeffery Snover, lead architect of Windows Server.

"the .NET team, is taking .NET and making it available on Linux"

Best of Luck, Team. Me too will try to see what's inside these "Core's 1.0" in my future posts.

Happy Beginning :)