Missing Silverlight Unit Tests in VS2012

31. Juli 2013

When you are missing the Silverlight unit test project templates in Visual Studio 2012 then you should check this link: http://social.msdn.microsoft.com/Forums/silverlight/en-US/180283df-6cac-45fd-bdce-ff3aec31cb7c/unable-to-create-a-silverlight-unit-test-project-on-vs2012

The problem is that the Silverlight Toolkit will install the template files to the first Visual Studio folder found – or even the default folder in case you installed your VS to a different location. So when you have VS2010 and VS2012 installed on your computer this may be the reason why you will not find the templates in VS2012.

To fix this simply lookup the ZIP files in the VS2010 folder (eg C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\VisualBasic\Silverlight\1033 and C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\VisualBasic\Silverlight\1033) and copy the Silverlight Test zips to the equivalent VS2012 folder.

Finally you will need to start „devenv.exe /installvstemplates“ manually to apply the new templates.

To create or use a new test project you will currently also need the Silverlight Unit Test Adapter – this will enable VS2012 to make the project visible as test in the testbrowser.

If this plugin does not fix the error message when creating a new test project you may need to edit the MyTemplate.vstemplate file inside the project templates ZIP:

Just edit the following line in the „Wizzard“-section to raise the version:
<Assembly>Microsoft.VisualStudio.Silverlight, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>

I had to go through all the steps to get the project working… Hope Microsoft will fix this soon.

EDIT:

There seems that there exists a different approach via NuGet (see in the answer here):

Just install „Install-Package SilverlightToolkit-Testing“ to the Testproject and manually add the „usings/imports“ to your test classes.

Unfortunately it was too late for me when I found this link – any comment approving this way would be great!

EDIT2:

Another problem came up with the „TestDiscoverer“ (test explorer won’t show the new tests). To fix this I had to add the missing DLLs to the GAC via gacutil:

Open the Visual Studio Command prompt as administrator, go to C:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Toolkit\dec11\Testing and there use gacutil to add the missing DLLs Microsoft.Silverlight.Testing.dll and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll

Still I’m struggeling to get my tests working – but finally they’re executed… Maybe my solution will come with a new post soon.

 

Werbeanzeigen

Installing Silverlight 4 Tools via Web Platform Installer

20. Dezember 2012

After my Web Platform Installer process finally reached the „Silverlight 4 Tools“ task it failed with the following message:

Installation Blockers:
1) Visual Studio 2010 or Visual Web Developer Express 2010 or Visual Phone Developer Express 2010 that matches the language version of Silverlight Tools 4 must be installed before installation of Silverlight Tools can continue. Silverlight Tools is available in other languages at http://go.microsoft.com/fwlink/?LinkId=177432.

 

Luckily a short search via Google gave me the answer:

I’ve installed the Visual Studio 2010 Service Pack 1 in prior and with this package the Silverlight Tools are already installed – unfortunately the Web Platform Installer does not recognize this. Well… even Microsoft seems to fail from time to time 🙂