Friday, June 26, 2015

Crystal Reports 13 and AppV 5 have issues

Crystal Reports 13 and AppV 5 have issues.  Crystal Reports 13 (CR) installs to some long paths which fail when loaded AppV5 tries to 'integrate' them.  A blog detailed shortening the installdir path to something much shorter but CR still failed for me.  My path without modifying the INSTALLDIR property was:
C:\ProgramData\Microsoft\AppV\Client\Integration\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\Root\VFS\ProgramFilesX86\SAP BusinessObects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64

224 Characters.

With the modified INSTALLDIR it was:
C:\ProgramData\Microsoft\AppV\Client\Integration\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\Root\VFS\ProgramFilesX86\1\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64

206 Characters.

This still failed.

The symptoms were errors in the application:





'The type initializer for 'CrystalDecisions.CrystalReports.Engine.CRPE' threw an exception.

Attempting to register the DLL's related to these resulted in these errors:




[Window Title]
RegSvr32

[Content]
The module "clientdoc.dll" may not compatible with the version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.

[OK]

Since AppV5 integrates HKCR keys natively into the system, if you can't register a DLL via a long path, then you will error with CR.



You can actually replicate a similar error by trying to 'install' CR with a long path, so it's not AppV5 that's at fault, but apparently something within the CR DLL's.  Trying to install to a path similar in length to the AppV5 path will fail:






So what is the maximum length CR can be installed to?



259 total characters.  At 260 characters or greater the installer fails with an error similar to the above. I'm not sure why the AppV5 path is significantly less, but it is for some reason.


In the end my path was:
D:\AppVData\PackageInstallationRoot\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\05D9D6C9-B77A-4376-94C6-C13E4764A8B0\Root\VFS\ProgramFilesX86\1\C\Common\X\win64_x64\

158 Characters.

To do this I needed to modify the SAP Crystal Reports 13 file with a MST transform file.  I did it by doing this:

Step  
Action
1   1.

Copy the ScreenTest III installation source files to a temporary folder C:\swinst on the sequencing machine (WSAPVSEQ07 - Windows 2008 R2 SP1 in this case).

1   2.
Install Orca.msi
1   3.

Launch Orca and ‘Open’  the Crystal Reports version

1   4.
Choose Transform from the menu > ‘New Transform’
1   5.
Select ‘Directory’ and find the first instance of ‘CrystalR|Crystal Reports for .NET Framework 4.0’



1   6.
Double-click ‘CrystalR|Crystal Reports for .NET Framework 4.0’ and copy the field.  Select the menu ‘Edit’ > ‘Replace’ and set ‘Find what’ as ‘CrystalR|Crystal Reports for .NET Framework 4.0’ and ‘Replace with:’ as ‘CrystalR|C’



And click on ‘Replace All’.  If you get prompted:


Select ‘Yes’.
1   7.
Repeat the process for ‘SAPBusin|SAP BusinessObjects Enterprise XI 4.0’  to ‘SAPBusin|X’


1   8.
Select ‘Registry’ and sort by ‘Value’.  Find the first instance of [INSTALLDIR]


1   9.
Do a ‘Replace’ and enter ‘[INSTALLDIR]Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0’ for ‘Find what’ and ‘Replace with’ as ‘[INSTALLDIR]C\Common\X’

And click on ‘Replace All’
1   10.
Result:


1   11.
Select the menu ‘Transform’ > ‘Generate Transform’ and save the file as something like:

SAP_DIR_Short2.mst
1   12.
Select the menu ‘Transform’ > ‘Close Transform’ and exit out of Orca.

You can now install SAP CR with a command line similar to this:
msiexec.exe /i "CRRuntime_64bit_13_0_14.msi" TRANSFORMS=SAP_DIR_Short2.mst INSTALLDIR="C:\Program Files (x86)\1" /qb