QuickStarts for WPF

Topics: Prism v4 - WPF 4
Jun 10, 2013 at 8:21 PM
Hi,

I am trying to use the QuickStarts to learn and practice on Prism. But it seems that the most quickstarts based on Silverlight only apart from "Modularity Quick Starts for WPF".

I have tried to run "Basic MVVM QuickStart" and "MVVM QuickStart" and am getting errors such as "The type or namespace name 'Practices.Prism' does not exist..." when I try to Build solutions.

So I tried to browse and add references manually (although I did run "RegisterPrismBinaries.bat" file), but I am getting the following error: "You can't add a reference to Microsoft.Practices.Prism.dll as it was not built against the Silverlight runtime..."

The references I try to add are from Prism/Bin/Desktop folder.

Can anyone suggest what examples are designed for WPF only as I am not trying to learn or design in Silverlight, for now anyway.

Thanks
Developer
Jun 10, 2013 at 9:17 PM
Hi,

First of all, there is a known issue in the Prism 4.1 registration script where the Prism libraries for Silverlight are registered for Silverlight 4 instead of Silverlight 5. In order to register the Prism library properly please modify the RegisterPrismLibrary.proj as described in the following work item:
If you wish to add the Prism libraries manually to your application or to the quick starts, take into account that there are different versions of the library for each supported platform:
  • \Bin\Desktop\ - contains the compiled Prism library for .NET 4.0.
  • \Bin\Silverlight\ - contains the compiled Prism library for Silverlight.
  • \Bin\Phone\ - contains the compiled Prism library for Windows Phone.
Although most of the quick starts included in Prism were implemented in Silverlight, most of the concepts and functionalities they portray can also be used in WPF. Therefore, I believe you could still find the Silverlight quick starts useful in order to learn about the capabilities provided by Prism and then apply them in your WPF application as you see fit.

I hope this helps,

Damian Cherubini
http://blogs.southworks.net/dcherubini
Jun 10, 2013 at 10:30 PM
Thanks for your reply,

I've changed the file and tried again, but still doesn't work. There is a registration line for .NetFramework\v4.0.30319. I have Framework 4.5 installed - not sure if I need to change that as well.

Also I am using evaluation copy of VS 2012, but this shouldn't affect right ?

Thanks again
Jun 10, 2013 at 10:40 PM
Tried MVVM QuickStart, the following dlls are resolved fine: Microsoft.Practices.Prism; Microsoft.Practices.Prism.Interactivity; Microsoft.Practices.Prism.

The following references can not be found:

Microsoft.Silverlight.Testing
Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight
Moq.Silverlight
Microsoft.Practices.Prism.GuidanceTools
Jun 11, 2013 at 6:53 PM
Hi,

Based on my understanding, you seem to be facing a configuration problem. If you want to use the MVVM Quickstart from Prism 4.1, you will need to have both Silverlight 5 and Silverlight 5 SDK installed to make it work out of the box. Regarding your missing assemblies you are listing, if your Quickstart solution still don't find them you can add them manually from your LIB folder inside the folder where you have installed Prism.

Note: Prism 4.1 is designed to work with .NET Framework 4.0. In order to make it work with .NET Framework 4.5, you can recompile Prism solution targeting that framework or you can download Prism for NET 4.5.

Regards,

Federico Martinez
http://blogs.southworks.net/fmartinez
Jun 12, 2013 at 10:12 AM
Thanks Federico,


I still can not open the quickstart projects. This is the error I am getting:

C:\Prism\Quickstarts\BasicMVVM\BasicMVVMApp\BasicMVVMApp.csproj : error : Unable to read the project file 'BasicMVVMApp.csproj'.
C:\Prism\Quickstarts\BasicMVVM\BasicMVVMApp\BasicMVVMApp.csproj(120,3): The imported project "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.


I have installed Sivlerlight5 tools for Visual Studio 2010. Visual Studio runs against .Net Framework 4 version. I really don't understand what do I need to do and I don't understand the path from the above error.


Thanks again
Jun 12, 2013 at 10:29 AM
I can find this: "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319"

But my Silverlight files are in the following folder: C:\Program Files\MSBuild\Microsoft\Silverlight\v5.0

Not sure what I need to do really.
Jun 12, 2013 at 5:51 PM
Hi,

Based on your description, it seems that you have a problem with your working environment. I would recommend you to try to install Prism and Silverlight again on a clean environment and see if you still face the same issue.

Regards,

Federico Martinez
http://blogs.southworks.net/fmartinez
Aug 9, 2013 at 11:58 AM
All works now, thanks. I had to re-install everything, including VS.