CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

Merging webapps. Moving (typed) Crystal reports from one application to another.

Two of my projects got so entangled that the only way out was merging them into one. They were several asp.net apps which had (code) references to each other. Two of them refering each other made the situation unworkable. Building the setup packages resulted in one working or the other working, depending which package I built first. When creating a setup package vs first builds all the projects in the package. When an assembly is refered it will be rebuilt and included. When an assembly is included in more than one package it is rebuild more than once. Leading to versioning hell.

I created a new web app and created some folders in it (from the VS solution explorer !) To these folders I added the content and code from the former apps. Works like a snap. Except for my (what else ?) Crystal reports. 90% of the conversion time was spent on getting these to work. This time the process was interesting.

Including the report “as is” leads to a succesfull build but an enigmatic error message at runtime:

Unable to find the report in the manifest resources

My apps use strong typed reports and reportdocuments from the component palette

Several observations

  • A report looks like a rpt file. Behind the scenes is a (generated) cs file
  • This cs file is generated when you save the report design. See the custom tool in the proprties of a report.
  • That code is generated in the namespace of the application.
  • The reportdocument is refred in the namespace of the page hosting it

The combination of the last two results in the error. To get things working took me these steps.

  1. Include the reports in the project
  2. Open the designer and save (to regenerate the report code)
  3. Make sure the pages on which the report is used are in the default namespace of the application
  4. Do not use reportdocuments

Step 3 is easier in C# then VB. Here you see the namespace in the code behind. Changing the name will have the desired effect. To get an overview of the namespaces in your app use the class viewer.

Too much of the reportdocument component is hard coded. Creating the report on the fly works just as well.

private MotivatieRaport mv = new MotivatieRaport();
dataSetProjektTonen.Merge(Projekt.ToonBaarProjekt(id));
mv.SetDataSource(dataSetProjektTonen);
CrystalReportViewer1.ReportSource = mv;

The only extra line is the first one.

Peter

 


Published Jun 08 2004, 08:16 AM by pvanooijen
Filed under:

Comments

Darren Grafton said:

I had the same Error using VS .Net and making a win Forms App after changing the name of my project. Just removing and then bringing it back fixed me up ;-))
# September 20, 2004 4:34 PM

Ken Lange said:

I had the same problem after moving a crystal report from one .Net Windows Form project to another.

"Unable to find the report in the manifest resources"

I struggled with this problem for a while before I found your explanation. Opening the report int the CR designer and saving it again caused the "code-behind" file to be re-written and got rid of the error.

Thank you.

Ken
# October 27, 2004 3:43 PM

Jane said:

I am trying to separate .rpt files from main application. Having ReportDocument component heavily used in all load events will require a lot of changes. Will appreciate any help...
# November 22, 2004 4:34 PM

Dhanya said:

Hi,
When i got this error, i changed my build action in the report properties, from 'none' to 'embedded resource'. It worked.

Thanks,
Dhanya
# July 7, 2005 11:04 PM

vaibhav said:

Thanks peter....
# February 16, 2006 11:09 AM

Paul Gaynier said:

Thanks Peter for the webpage.

Thanks Ken for your comment. Having the same problem and all I needed to do was open the CrystalReport in the designer and make a change so that it had to be saved before a recompiling. It worked fine.
# May 3, 2006 10:00 AM

srinath said:

I have a problem regarding the calculation and displaying of graph using crystal reports.
# June 24, 2006 2:17 PM

MAHESH said:

I HAVE SAME PROBLEM AND IAM VERY MUCH NEW TO CRYSTAL REPORTS.

EXCEPTION DETAILS:

"CrystalDecisions.CrystalReports.Engine.InternalException: "Unable to find the report in the manifest resources. Please build the project, and try again."

private Database crDatabase;

if (str_rpttyp == "regionwise")

crDatabase = crReportDocument1.Database;

//AT THIS STATEMENT IT IS SHOWING ABOVE ERROR.

CAN ANYBODY HELP

# January 18, 2007 5:48 AM

pvanooijen said:

As you are new to CR my first suggestion is to switch to SQL reporting services, which might save you a lot of frustration.

Case else: didn't all suggestions work ?

# January 18, 2007 7:20 AM

N.Mahesh said:

Iam new to CR's I have same problem .I found soln in net as opening report in CR designer and saving it ,or In properties change build action none to embedded resources.but none of them is not working.

Looking for help.

Thanks in advance.

# February 21, 2007 6:33 AM

pvanooijen said:

In case you are new to CR may I repeat my last comment ?

I gave up on CR...

# February 21, 2007 7:23 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!