Automatically Remove and Sort Usings on Save in Visual Studio 2017

Manually removing and sorting Usings can become a tedious process when working with many classes and files. Handle this automatically when saving any file in Visual Studio 2017 using the Productivity Power Tools 2017 extension bundle installer, specifically the Power Commands extension. These can be installed directly by navigating to Tools | Extensions and Updates … in Visual Studio.

After installing the extension, go to Tools | Options | Productivity Power Tools | Power Commands. Check Remove and Sort Usings on save.


Test this by editing a code file and saving (Ctrl+S). Any unused Usings should be automatically removed and existing ones sorted.

For ReSharper users, there is a chance that this setting does not work. This is a known issue. As a work-around, deselect Hide overridden VS menu items in ReSharper options.

Navigate to ReSharper | Options | Environment | Keyboard & Menus. Uncheck Hide overridden VS menu items.


The Power Commands extension should be working again.

Deploying an ASP.NET Core Web Application to Heroku

Heroku is a cloud platform that supports a number of languages. .NET Core has yet to be officially supported. The options for deploying .NET Core applications to Heroku are using Third Party buildpacks or container support. It can take some digging to find a buildpack that is well maintained and working properly for the version of .NET Core you are using.

For my purposes, I am deploying a brand new ASP.NET Core Web Application using Version 1.1. In order to get this deploying successfully to Heroku, first download the Heroku CLI.

From the command prompt, login to your Heroku account to get started.

heroku login

Navigate to the project’s root directory and create the app you will be deploying to.

heroku create

Use the set:buildpacks command to point the app to the desired buildpack:

heroku buildpacks:set

From here all that is left is to deploy the application to Heroku.

git push heroku master

See a demo application here.





Exporting Entire Tasks in Asana

Asana has long had a nice feature for exporting Projects to CSV. However, what if you want to export and view all contents in a single Task? This feature does not exist, however I use a helpful work around to accomplish this.

From the Task menu, select more actions:


Select Print …


From the Print Dialog, instead of sending the document to a printer, select Save as PDF as the Destination.


This will save the entire task to PDF format. The formatting is not as palatable as it could be, but it will display all Comments, Subtasks, Comments on Subtasks, etc., which is a nice to have for larger Tasks.

Using Simple Injector with ASP.NET MVC 5

While ASP.NET Core has built-in capabilities for dependency injection, when attempting to accomplish this in MVC 5 one may come across a strange error:

No parameterless constructor defined for this object.

At a glance this is not entirely helpful. Adding a parameterless constructor is not a viable solution when you need to inject an interface. A third party library is still the best option for accomplishing this in MVC 5. This is a matter of preference, but for my needs Simple Injector continually stands out as one of the fastest options. It’s also lightweight and easy to install. Here is an example service for the HomeController:

private readonly IMyService myService;

public HomeController(IMyService myService)
     this.myService = myService;

public ActionResult Index()
     var model = this.myService.GetItems();

     return this.View(model);

Just add the SimpleInjector.Integration.Web.Mvc NuGet package to your solution and a bit of configuration:

protected void Application_Start()

     // 1. Create a new Simple Injector container
     var container = new Container();

     // 2. Configure the container (register)
     container.Register<IMyRepository, MyRepository>(Lifestyle.Transient);
     container.Register<IMyService, MyService>(Lifestyle.Transient);

     // 3. Optionally verify the container's configuration.

     // 4. Register the container.
     DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));

Simple Injector will take care of the rest.