I Heart ReSharper!

Friday, April 03, 2009 3:56:27 PM (Mountain Standard Time, UTC-07:00)

I'm still surprised by just how many people still aren't using ReSharper. It's an amazing productivity adding for Microsoft Visual Studio.  Once you've spent the time learning a few keyboard shortcuts you will not go back to naked studio.

There are few things that are more frustrating then jumping on a machine that doesn't have ReSharper installed, then trying to edit some .cs files.

In an effort to prevent myself from ever having to jump on a pc that's still missing the glory of ReSharper, I decided to throw together a quick screen cast showcasing some of the features i enjoy.

ReSharper Warm Fuzzies Screen cast

If you haven't already. please, please give it a try (do it for me). It's a good addiction!

#

Deploying .NET Applications – Learning MSBuild and ClickOnce

Friday, March 13, 2009 12:56:23 PM (Mountain Standard Time, UTC-07:00)

I recently finished reading.

Deploying .NET Applications: Learning MSBuild and ClickOnce (Expert's Voice in .Net)

I was interested in this book mainly to find an easier way to deploy ClickOnce applications via an automated build. Most of my build automation experience has been with Nant, so I figured learning MSBuild couldn't hurt.

This book targets the Visual Studio 2005 time frame, so some of the things that it describes is out dated, mainly in regards to ClickCnce.

There was a little coverage on mage.exe but not as much as I had liked. If you're looking for a book to get you into the world of Clickonce or MSBuild, this one's pretty good!

Here are some of the things that I learned straight from the book.

MSBuild

Microsoft.Build.Framework and Microsoft.Build.Utilities contains some stuff to help you with your builds. There's an ITask interface and a Task base class that you can implement if you want to run some custom tasks from MSBuild.

ClickOnce is driven by two XML-based manifest files called the deployment manifest and the application manifest.

  • Deployment manifest (.application) contains information specific to the deployment of the system.
  • Application manifest (.manifest) captures information specific to version of the system.

ClickOnce Deployment

The ClickOnce technology also has a programmatic interface that you can use to customize deployment and updates. For example, if you have a plug-in where the core of the application is deployed initially and then users are allowed to choose optional features (plug-ins) and have them installed on demand, the ClickOnce API can help.

ClickOnce applications have to be deployed to a Web server, to a file server, and/or to removable media (such as CD/DVD). Moreover, you can deploy these applications in one of two modes: offline or online.

For applications that require finer-grained control over doing updates, application authors can use the ClickOnce APIs to customize installation and updates.

Code Access Security (CAS)

  • Permission: The authority to do something.
  • Permission set: A grouping of arbitrary permissions.
  • Origin based Evidence: Where your code comes from determines what permissions your code gets.
  • Content base evidence: Your code content is signed and has a publisher certificate, and that determines what permissions you get.
  • Code Group: Associates evidence with a permission set
  • Security Policy: Policies define a hierarchy of code groups.

On-Demand Download

ClickOnce offers a facility that called on-demand download. The idea is that you create groups of files and then use the ClickOnce APIs to download each group at runtime. The initial download is reduced to what is needs to be downloaded to run the application, and if a piece of functionality is not needed, it is not downloaded.

You can get the path to the Data directory via:

  • AppDomain.CurrentDomain.GetData("DataDirectory");
  • ApplicationDeployment.CurrentDeployment.DataDirectory;
  • Application.LocalUserAppDataPath;

#

BDD on Creatine

Thursday, March 12, 2009 9:46:14 AM (Mountain Standard Time, UTC-07:00)

In an attempt to further understand BDD, I chose to revise the code from my previous post after receiving some amazing advice from two people I regard highly (Scott & JP). I should state that this is my interpretation of that advice. This may or may not be the direction they were trying to guide me towards.

   12 public class when_prompted_to_save_changes_to_the_project : concerns_for<SaveChangesView>

   13 {

   14     context c = () => { presenter = an<ISaveChangesPresenter>(); };

   15 

   16     after_the_sut_has_been_created after = () =>

   17                                                {

   18                                                    save_changes_window = sut;

   19                                                    save_changes_window.attach_to(presenter);

   20                                                };

   21 

   22     protected static ISaveChangesPresenter presenter;

   23     protected static SaveChangesView save_changes_window;

   24 }

   25 

   26 public class when_the_save_button_is_pressed : when_prompted_to_save_changes_to_the_project

   27 {

   28     it should_save_the_current_project = () => presenter.was_told_to(x => x.save());

   29 

   30     because b = () => save_changes_window.save_button.control_is(x => x.OnClick(new EventArgs()));

   31 }

   32 

   33 public class when_the_cancel_button_is_pressed : when_prompted_to_save_changes_to_the_project

   34 {

   35     it should_not_continue_processing_the_previous_action = () => presenter.was_told_to(x => x.cancel());

   36 

   37     because b = () => save_changes_window.cancel_button.control_is(x => x.OnClick(new EventArgs()));

   38 }

   39 

   40 public class when_the_do_not_save_button_is_pressed : when_prompted_to_save_changes_to_the_project

   41 {

   42     it should_not_save_the_project = () => presenter.was_told_to(x => x.dont_save());

   43 

   44     because b = () => save_changes_window.do_not_save_button.control_is(x => x.OnClick(new EventArgs()));

   45 }

 

I hope this is slightly more soluble, then my previous post.

#

BDD on Steroids

Wednesday, March 11, 2009 1:40:59 PM (Mountain Standard Time, UTC-07:00)

In the last couple of weeks I had a chance to sprinkle some of JP's syntactic sugar, all over my projects. It's amazing how much more concise my units test have become. I've had a couple of issues where I was mocking out the behavior of some Win Forms controls, but for the most part it's been an awesome experience!

I just wanted to take a moment to say Thank you JP! I am enjoying using your BDD (on steroids) extensions. If you haven't already you need to check it out here. NOW!

Maaad, maaaad props Mr. JP!

 

   10     public class behaves_like_save_changes_view_bound_to_presenter : concerns_for<SaveChangesView>

   11     {

   12         context c = () => { presenter = an<ISaveChangesPresenter>(); };

   13 

   14         because b = () => sut.attach_to(presenter);

   15 

   16         static protected ISaveChangesPresenter presenter;

   17     }

   18 

   19     public class when_the_save_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter

   20     {

   21         it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.save());

   22 

   23         because b = () => EventTrigger.trigger_event<Events.ControlEvents>(

   24                               x => x.OnClick(new EventArgs()),

   25                               sut.ux_save_button

   26                               );

   27     }

   28 

   29     public class when_the_cancel_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter

   30     {

   31         it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.cancel());

   32 

   33         because b = () => EventTrigger.trigger_event<Events.ControlEvents>(

   34                               x => x.OnClick(new EventArgs()),

   35                               sut.ux_cancel_button

   36                               );

   37     }

   38 

   39     public class when_the_do_not_save_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter

   40     {

   41         it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.dont_save());

   42 

   43         because b = () => EventTrigger.trigger_event<Events.ControlEvents>(

   44                               x => x.OnClick(new EventArgs()),

   45                               sut.ux_do_not_save_button

   46                               );

   47     }

 

Update: I posted the wrong link up top. here's the latest link.

#

Data-Driven Services with Silverlight 2

Wednesday, March 11, 2009 7:54:23 AM (Mountain Standard Time, UTC-07:00)

I recently finished reading...

Data-Driven Services with Silverlight 2

I have been wanting to get in to the world of WCF for some time now, but wasn't really sure how to get started. This book was good at explaining how to get into WCF quick and easy. The sample apps that the author goes through and provides are pretty cool which makes it more fun.

The book explains how data binding in silverlight (which seems to be similar to how it works in WPF), how to pass objects across the wire using WCF. It explains what RESTful services means, and how to build them leveraging tools on the .NET stack.

The sample apps include one that consumes Amazon's RESTful services, as well as a Twitter client called SilverTwit. There's lots of code to dig through, and try out for yourself.

For anyone interesting in Silverlight or WCF, this is a good book to get you started.

If you're looking for the sample code that comes with the book, you can find it here. http://examples.oreilly.com/9780596523091/

#