Saturday, 9 October 2010

Fixing GAC when Shfusion.dll does work with c:\windows\Assembly in Windows 7


I just had to publish this, countless hours spent over this trying to figure out what the heck was wrong with a project not compiling in Visual Studio 2010 using CrystalDecisions Assemblys, namely:


Everytime i tried to compile it would give out an error:

"Type ReportDocument is not defined"

When all the correct references were being made in project properties. So what could be wrong?

As my investigation went by i realise that i could not properly see the usual assembly listing contents, instead i would see the files and folders normally and tought there could be a relationship to that.

Rapidly i found it's relationship to a nice file named shfusion.dll
Altough it does not help directly with this issue, you can read more about it here:

But, trying a regsvr32 C:\Windows\Microsoft.NET\Framework\v2.0.50727\shfusion.dll would return that shfusion.dll was loaded, but the DllRegisterServer entry point was not found.

Exporting the corresponding registry keys from a healthy PC did not help

This usually happens when user has no permisssions to write to the corresponding registry keys but i was running command line with administrative permissions and the same command worked on a good PC from this standpoint.

Later, i tried to fully remove .NET Framework and it was then that i realised that removing .NET Framework 4 from my system would restore the correct operation for shfusion.dll . Surely, later i read that shfusion.dll was deprecated in .NET Framework 4, but other systems had it and it continue to load properly.

With .NET framework uninstalled, now, of course Visual Studio wouldn't even start as it is based on WPF which is provided by Framework 4:

I reinstalled Visual Studio 2010, and SHFusion.dll stoppped working again, so there must be a relationship with the .NET Framework 4 bundled with this installation i tough. I fully uninstalled once again the Framework 4, and then installed it directly from microsoft . While installation was going i noticed some KB's being applied that seemed bug fixes so i tough there was a hope, and voila, there was:

After this it was piece of cake, just loaded my project and recompiled with correct references in the project propeties and back in track again for productivity:

I really hope this may help a lost soul out there as there were just no answers for this on the internet while i was searching.

Taken from: