This project has moved and is read-only. For the latest updates, please go here.

Is 3 assembly is "Light" ?

Jul 18, 2013 at 2:30 PM
minimum count references in SL5 project is three:
  • GalaSoft.MvvmLight.SL5.dll
  • GalaSoft.MvvmLight.Extras.SL5.dll
  • Microsoft.Practices.ServiceLocation.dll
  • Why need to reference whole "Extras" if used only EventToCammand ?
  • Why I need reference ServiceLocator if it unused at all?
Jul 18, 2013 at 4:06 PM
Edited Jul 18, 2013 at 4:31 PM

I am happy to explain to you the decision behind this split in assemblies.

Many firms have a long and arduous process when adding any external assembly. In the case of MVVM Light, I wanted to make this easier, so I isolated the two classes that require an external reference in the Extras assembly. These are the EventToCommand and the SimpleIoc classes. I could have gone even further and isolated the SimpleIoc in its own assembly, but this would have been kind of silly in my opinion.

So now we have:

GS.dll --> Everything without any external reference

-> System.Windows.Interactivity.dll (for EventToCommand)
-> Microsoft.Practices.ServiceLocation.dll (for SimpleIoc)

This makes a lot of people's life easier. In your case, for some unknown reason, you seem adverse to include the MSFT.Practices.ServiceLocation assembly. I don't quite know why, but if it is really making your life a living hell, you can always get the code from here and recompile, leaving out the SimpleIoc class. Note however that you will need the System.Windows.Interactivity.dll anyway.

Also, note that the Blend SDK has a behavior named InvokeCommandAction which is very similar to EventToCommand (MVVM Light's behavior is a little more powerful in certain cases). This is a viable alternative if your needs are simple.

Hopefully this helps,