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.
- Include the reports in the project
- Open the designer and save (to regenerate the report code)
- Make sure the pages on which the report is used are in the default namespace of the application
- 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