Print Page | Close Window

Crystal Errors when running compiled application..

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Writing Code
Forum Discription: .NET 2003 programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=7766
Printed Date: 22 May 2024 at 6:50am


Topic: Crystal Errors when running compiled application..
Posted By: cboshdave
Subject: Crystal Errors when running compiled application..
Date Posted: 22 Sep 2009 at 10:17am
I have embedded several Crystal 11 reports into my application (first time obviously).  They run fine on my machine in a 2008 c# dev environment.  I am not using .net for this. 

I have published to a corporate server.  I used the "one-click" publish which may be causing me some grief??  Anyway, the application installs just fine and when the user selects the report, the app produces an error window that says: "Could not load file or assembly 'CrystalDecisions.Shared, Version=11.5...

I have tried to force include every possible file in the publish of the app.  I have seen the server Merge install stuff.  I don't know why I would need this though because I am trying to run these reports on the local machine.  Not sure what else I need to do??  Any suggestions would be appreciated. 

Dave


-------------
CBOSH - Come Big or Stay Home!



Replies:
Posted By: hilfy
Date Posted: 25 Sep 2009 at 6:11pm

Which version of Visual Studio are you running?  If it's 2005, there are a couple of things you need to do.

1.  Make sure that the Crystal Merge Module (crystalreports11_5_net.msm) is included in the Detected Dependencies of the setup.
 

2.  Click on the msm under Detected Dependencies and open the "(MergeModuleProperties)" section at the top of the Properties viewer.  Scroll down until you see "Keycode".  Enter your Crystal license key in the key code.  The easiest way to get this is to go to Help|About in Visual Studio - it will be listed in there.

I don't know a lot about the "one-click" install, but I know that this works with a "Setup Wizard" type of install.  However, installing the merge module will make sure that the assemblies you app needs to run reports are installed.
 
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: cboshdave
Date Posted: 28 Sep 2009 at 7:57am
As I mentioned, it is a Visual Studio 2008 C# environment.  I will see if your suggestions still apply. 

Thanks,
Dave


-------------
CBOSH - Come Big or Stay Home!


Posted By: cboshdave
Date Posted: 28 Sep 2009 at 2:28pm
A couple more pieces of information now. 

I did not notice before, but I have several warnings that might be applicable.

1.  Unable to apply publish properties for item crystaldecisions.enterprise.framework".   

and about 10 more related to other CrystalDecisions.xxx things. 

I saw somewhere that I need to enter my crystal 11.5 key somewhere but it was not clear where and I cannot find a place to enter it and have it compile with the code. 



-------------
CBOSH - Come Big or Stay Home!


Posted By: hilfy
Date Posted: 29 Sep 2009 at 7:49am

Crystal XI does NOT integrate with VS 2008.  There are no plans to ever do that integration.  Crystal 10 comes with VS and it will integrate with Crystal 2008.

I know this from experience - I fought with VS 2008 for over a week to get it to do some stuff with XI so that I didn't have to upgrade our reports.

If you're not using .NET with C#, what are you using?  The error message you gave me says that your program is looking for a .NET assembly.

 

-Dell



-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: cboshdave
Date Posted: 29 Sep 2009 at 8:27am
Well, that answers that I suppose.  I will recompile the reports in version 10 and see if it works there.  I am using Visual Studio C#, but it is a client app rather than a web app.  I don't know if it makes a difference. 
 
I will recompile the reports in v10 and see if it works!
 
Thanks again,
Dave


-------------
CBOSH - Come Big or Stay Home!


Posted By: cboshdave
Date Posted: 29 Sep 2009 at 9:02am
One more thought.  When I add the reports, the component is showing a "Full Path" property that points to my local hard drive. 
 
When the users install and run, the error seems to be that the code is trying to pull up the report from the reference to my drive.  I thought I was compiling these reports into the code???  Do I need to change an option to make this work properly??  Even if I change the "Copy to Output Directort" option to Copy Always, the Full Path still has a reference to my hd??
 
Thanks again!
Dave


-------------
CBOSH - Come Big or Stay Home!


Posted By: hilfy
Date Posted: 29 Sep 2009 at 9:42am
What I do when I'm compiling a report into the app is create an object of the report class instead of loading the report from a file.  In the sample code below, I'm using an .NET DataSet as the data source for the report, so I don't set the table logins.  I've overridden the Creator for the viewer form so that I can pass into it the DataSet and information about which report to run (there are several in this particular application...)
public BOEAuditRptViewer(DataSet dsAuditInfo, bool isTax, string auditType)
{
  InitializeComponent();
 
if (isTax)
  {
    ConfigureTaxAuditReport(dsAuditInfo);
  }
 
else
 
{
    ConfigureAuditReport(dsAuditInfo, auditType);
  }
}
private void ConfigureAuditReport(DataSet dsAuditInfo, string auditType)
{
  //Create a typed-report object
 
BOEUserAuditRpt auditRpt = new BOEUserAuditRpt();
  auditRpt.SetDataSource(dsAuditInfo);
  //set the Profile Type parameter so that report data is filtered
 
string profileType = "ALL";
 
switch (auditType)
  {
   
case "Consumer Marketing":
      profileType =
"CMI";
     
break;
   
case "Corporate":
      profileType =
"COR";
     
break;
   
case "Hazard":
      profileType =
"HAZ";
     
break;
  }
  //Now that we know the param value, set the parameter
  auditRpt.ParameterFields[
"Profile Type"].AllowCustomValues = true;
  auditRpt.ParameterFields[
"Profile Type"].CurrentValues.Clear();
  auditRpt.ParameterFields[
"Profile Type"].CurrentValues.AddValue(profileType);
  auditRptViewer.ReportSource = auditRpt;
}
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: cboshdave
Date Posted: 29 Sep 2009 at 1:12pm
Okay.  I believe that is what I am already doing.  (I have no idea what happened to the HTML here or how to fix it.  Sorry!)

file:///C:%5CDOCUME%7E1%5Cdmw%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml -         PrintRpt.PrintToPrinter(1, true, 0, 0);
        PrintRpt.PrintOptions.PrinterName = getdefaultprinter();
        PrintRpt.PrintToPrinter(1, true, 0, 0);

What are the file properties for your BOEUserAuditRpt? I assume this is .rpt file that you have pulled into your app.  Mine are as follows:
Build Action: Embedded Resource
Copy to Output Directory: Copy Always
Custom Tool: CrystalDecisions.VSDesigner.CodeGen.ReportCodeGenerator
Custom Tool Namespace: "" (blank)
File Name: SunSTD10.rpt
Full Path: C:\Documents and Settings\dmw\My Documents\Personal\Cert Preview\Report\SunSTD10.rpt

The Full Path seems to be where it is failing a "find" at the user level.  This is an unchangeable option though. 

By the way, I really appreciate the help!  I am so close and you are performing way above the call of duty!

Dave



-------------
CBOSH - Come Big or Stay Home!



Print Page | Close Window