Prism 4.1 & GAC Problem

Topics: Prism v4 - Silverlight 4
Aug 13, 2012 at 12:47 PM

After intalling and registering Prism 4.1 I've found that Prism dlls do not listed in "Add Reference.." list filtered by Silverlight 5.
I've registered them by using GacUtil in MSVS 2010 SP1 command prompt:
gacutil /i "C:\Program Files (x86)\Microsoft Prism v4.1\Bin\Silverlight\Microsoft.Practices.Prism.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Prism v4.1\Bin\Silverlight\Microsoft.Practices.Prism.Interactivity.dll"
...
and so forth.
There was message that dll registered successfully for each dll.
However these dlls do not appears in "Add Reference.." list filtered by Silverlight 5.
Then I'm trying to add Microsoft.Practices.Prism.dll in my fresh new SL5 project and getting error message that:
Error 1 Cannot resolve reference assemblies. Please check the reference assemblies. Could not load file or assembly 'System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. Не удается найти указанный файл. SilverlightApplication2 E:\Work\Projects\testProjects\SilverlightApplication2\SilverlightApplication2\MainPage.xaml
Currently I'm can't build SL5 projects with linked prism dlls.

I was wrong thinking that adding dll to GAC will help to show dll in Add Reference.. list.

I used this to get dll in AddRef list: http://compositewpf.codeplex.com/workitem/9225

But I don't understand why adding dll to GAC led to this issue. And I still getting this error.

Developer
Aug 13, 2012 at 8:03 PM
Edited Aug 13, 2012 at 8:04 PM

Hi,

Based on my understanding assemblies installed to the GAC are not necessarily listed in the Visual Studio References dialog box and it is highly recommended that you not install your assemblies to the global assembly cache, unless you want to share your assemblies with other applications running on that system.

The Prism library provides the RegisterPrismBinaries.bat which does not put the assemblies in the GAC, it only adds registry entries so that Visual Studio will list the Prism and Unity assemblies in the Add References dialog.

So far, I'm not familiar with the error your are receiving, perhaps you could check the following thread from the Silverlight forums where a similar issue was described:

Also, I believe you could try, uninstalling the assemblies from GAC.

Regards,

Agustin Adami
http://blogs.southworks.net/aadami

Aug 14, 2012 at 4:46 AM

Thank you for answer!

I've tried to uninstall assemblies from GAC:

gacutil /u Microsoft.Practices.Prism.dll for each one, but there was message that dll not found.

I've looked in c:\windows\assembly directory to locate and delete dlls but nou found them.

I've tried to follow recomendations from thread References in Silverlight 5, reinstalling MSVS 2010, .NET FW, SL SDK but without success.

However, lastly I tried to install in gac system.windows, and error about this dll has gone, but appeared errors about system and system.core. I've gac'ed them too, and now I am able to build project without errors. I hope I'll never see this error again.