可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I have a windows application written in C# and am trying to display crystal report using crystal report viewer. The name of my report is "receiptReport" and I am using following line to show report in viewer:
receiptReport rpt = new receiptReport();
crystalReportViewer.ReportSource = rpt;
I am receiving following error: Unable to find the report in the manifest resources. Please build the project, and try again.
I have tried by setting Build Action of report file 'receiptReport.rpt' to Embedded Resource but still now luck.. Im using VS2010..
回答1:
A lot of things go wrong with CR after a lot of googling one of these fixes will solve the problem.
1) Full FullResourceName property in the reports code file (.cs) will be wrong if the containing folder(s) has spaces in its name. The best fix is to rename the folder to remove spaces if you manually edit the code file the error will keep coming back
2) Make sure the build property of the rtp file is set to Embedded Resource
3) Use Developer Express for reporting and avoid all headaches in the first place
回答2:
Well... I had the same problem.
My solution was to edit the properties of the Report, and change the Custom Name Space.
Lets say that I was caling the report from Name Space "A", and my report was in the same Tool Name Space but in other DLL.
So, I've cleared the Custom Name Space... and rebuilt everything.
Problem solved for me.
回答3:
Name the Folder name which contains the Crystal Report, without Space.
For Eg: Folder Name "Report Section" as "ReportSection"
回答4:
My issue was that the directory's name where my reports was located was all numbers in order to correspond to the client codes we use. So what happened was that Visual Studio named the class Reports._1234567
, while my directory was "\Reports\1234567". When I renamed the folder "_1234567" then the folder matched the class name and everything worked fine.
In the report's code behind the FullResourceName
property is this:
public override string FullResourceName {
get {
return "app700.Reports._1234567.CrystalReport1.rpt";
}
set {
// Do nothing
}
}
The underscore character was added by VS because you can't have a class name that does not start with a letter or underscore.
回答5:
This is a silly mistake done by a number of programmers.
It actually happens only when you transfer or change a project or report from one project to another project.
"Unable to find the report in the manifest resources - Crystal Report / C#"
Solution:
Go into the project's Report Form's .CS file
Now You have:
public override string FullResourceName
{
get
{
//Note this path it must be yours project name Or full path of Crystal report
return "FullPath_from_project_name.Crystalreport.rpt";
}
set
{
// Do nothing
}
}
I"m deadly sure you must Error free
If not mail me with Error:kapil.dev824@yahoo.com
回答6:
My problem was solved by removing a folder which contain space .
after i change it then this error is gone.
:)
回答7:
I received the same "Unable to find the report in the manifest resources" error in VS 2010 after manually copying *.rpt and *.vb files into a different solution's directory.
After checking the embedded resource setting everyone speaks about in this post (it was already set to embedded resource),
I solved the problem by right-clicking the .rpt file in Solution Explorer and selected "Run Custom Tool".
回答8:
VS2010 in VB.Net. In the Solution Explorer window, I moved the .rpt file from the root folder to a sub folder for reports. This fixed the error for me.