Feb
27
2015

Context Aware Access to Command Prompt or PowerShell in Windows

I have been ramping up on ASP.NET 5 which has had me in PowerShell or the command prompt quite a bit (this is to support upcoming x-plat features).  In many cases, I have needed to run commands in the context of a folder.  Here is an easy way to do this in Windows Explorer…  

From the Windows File menu

Suppose I am in a folder and I want to immediately go to the command prompt or PowerShell and already be in the context of that directory?  I simply go to the File menu option in Windows Explorer ([Alt] F keyboard shortcut) and select either the command prompt or PowerShell as seen below:

File menu in windows explorer
Letters appear when [Alt] key is used

If I choose the command prompt, it will put me in the same directory as the current open window as seen here:

path in windows and command prompt

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Feb
19
2015

Creating an ASP.NET 5 Starter Application

This blog post is part of a series covering ASP.NET 5  To follow along, this post requires installing Visual Studio 2015 CTP.

This post will cover:

  • Creating the project
  • Examining the project
  • Comparing to "Empty project"

The goal of these topics is not only to show “how-to”, but to answer the “what is that…” and “why is that” as well.  It is written as if you are following along in Visual Studio 2015 (tutorial style), yet with enough supplemental detail to simply read (article style). Although not an exhaustive dive into each area, it should provide enough context to quickly get started with ASP.NET 5.

Creating the project

To create a new ASP.NET 5 application, it is necessary to think in terms of projects, not web sites.  The Web Site… option as seen below is still supported in Visual Studio 2015 to support legacy site development.  The specific “ASP.NET vNext” features require the Project… option. With this in mind, in Visual Studio 2015 select from the top menu bar: File --> New --> Project...

visual studio 2015 new project

After selecting Project…, a new project dialogue box appears.  On the left side of the box, select the Web option under the language of preference (Visual C# used below).  From there, select ASP.NET Web Application and choose the solution/project name and file location.  This post will use ASPNET5 as the solution name, and StarterSite as the project name.

asp.net web application project
ASP.NET 5 Class Library and Console Application project templates will be covered in an upcoming blog post

Another dialogue box will appear to fine tune the type of web project desired. In this post, we will look at the ASP.NET 5 Starter Web template.

image

 

Examining the project

The following is the default structure for the ASP.NET 5 Starter Web project:

image

A closer look at the wwwroot folder reveals helpful static (non-compiling) content:

image

The bin folder contains the AspNet.Loader.dll file, which is needed in deployment to IIS.

The css folder contains the site.css file, with minimal style declarations.

The lib folder contains multiple references for support of Bootstrap and jQuery, and contains the _references.js file, which is used to support IntelliSense in Visual Studio.

Back at the project level items, folders such as Controllers, Models, and Views contain what is needed to support MVC.

The Migrations folder contains code to support Entity Framework database migrations.

For an understanding of gruntfile.js and bower.json, take a look at this post by Mike Wasson.

 

Comparing to “Empty project”

In a previous post discussing how to create an ASP.NET 5 site with the “empty” template, there was significantly less folders and files.  This does however help us to appreciate what is truly required for ASP.NET 5 to run.  The folder and files below represent the true minimum:

wwwroot Folder of static files served to client. No code or ‘razor’ goes here
project.json File for managing project settings
Startup.cs File for startup and configuration code

The wwwroot folder in the “empty project” only contains the bin with the AspNet.Loader.dll file – much less than what was shown earlier in this post.

The content of the project.json file and the Startup.cs file also differ from the ‘empty’ with more code to support features commonly used.  The point here is that much has been added to the ‘starter’ template to provide a basis for common tasks associated with web site development.

Summary

In conclusion, there is a solid basis for quick web development when using the ASP.NET 5 Starter Web project template.

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Feb
11
2015

WebCamp 2015

imageLearn how to develop beautiful, fast and interactive websites! Join us for a FREE WebCamp in your local area to get hands-on with the new release of ASP.NET and Web Tools for Visual Studio 2013. We’ll discuss the Microsoft tools and resources that can help you build cutting-edge websites, and then show you how to deploy them with Microsoft Azure. WebCamps are no-fluff, hands-on learning events for developers, by developers. Don’t miss this exciting chance to sharpen your coding skills and create something amazing. Register now for a Web Camp near you. http://aka.ms/msftwebcamps

For the Web Camps that I am presenting at, here are some resources I would like to share:

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).

Resources

Archives