我将所有Crystal Reports保存在一个文件夹中:
VOUCHERS-->SALE-->BILLFORMATS
例如:第一份报告的位置是:
VOUCHERS-->SALE-->BILLFORMATS-->BillFormat1.rpt
Vegi_Manager是根名称空间。
当我构建项目并尝试在代码中使用报表时,它会抛出错误:
Unable to find the report in the manifest resources
.cs文件有问题吗?
代码:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Vegi_Manager.VOUCHERS.SALE.BILLFORMATS {
using System;
using System.ComponentModel;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;
using CrystalDecisions.CrystalReports.Engine;
public class BillFormat1 : ReportClass {
public BillFormat1() {
}
public override string ResourceName {
get {
return "BillFormat1.rpt";
}
set {
// Do nothing
}
}
public override bool NewGenerator {
get {
return true;
}
set {
// Do nothing
}
}
public override string FullResourceName {
get {
return "Vegi_Manager.VOUCHERS.SALE.BILLFORMATS.BillFormat1.rpt";
}
set {
// Do nothing
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.CrystalReports.Engine.Section Section1 {
get {
return this.ReportDefinition.Sections[0];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.CrystalReports.Engine.Section Section2 {
get {
return this.ReportDefinition.Sections[1];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.CrystalReports.Engine.Section Section3 {
get {
return this.ReportDefinition.Sections[2];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.CrystalReports.Engine.Section Section4 {
get {
return this.ReportDefinition.Sections[3];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.CrystalReports.Engine.Section Section5 {
get {
return this.ReportDefinition.Sections[4];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmName {
get {
return this.DataDefinition.ParameterFields[0];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmJurisdiction {
get {
return this.DataDefinition.ParameterFields[1];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmPhoneNo {
get {
return this.DataDefinition.ParameterFields[2];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmMobileNo {
get {
return this.DataDefinition.ParameterFields[3];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmDetails {
get {
return this.DataDefinition.ParameterFields[4];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmAddress {
get {
return this.DataDefinition.ParameterFields[5];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmCity {
get {
return this.DataDefinition.ParameterFields[6];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmState {
get {
return this.DataDefinition.ParameterFields[7];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamFirmBankDetails {
get {
return this.DataDefinition.ParameterFields[8];
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public CrystalDecisions.Shared.IParameterField Parameter_ParamBillNo {
get {
return this.DataDefinition.ParameterFields[9];
}
}
}
[System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions), "report.bmp")]
public class CachedBillFormat1 : Component, ICachedReport {
public CachedBillFormat1() {
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public virtual bool IsCacheable {
get {
return true;
}
set {
//
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public virtual bool ShareDBLogonInfo {
get {
return false;
}
set {
//
}
}
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public virtual System.TimeSpan CacheTimeOut {
get {
return CachedReportConstants.DEFAULT_TIMEOUT;
}
set {
//
}
}
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
BillFormat1 rpt = new BillFormat1();
rpt.Site = this.Site;
return rpt;
}
public virtual string GetCustomizedCacheKey(RequestContext request) {
String key = null;
// // The following is the code used to generate the default
// // cache key for caching report jobs in the ASP.NET Cache.
// // Feel free to modify this code to suit your needs.
// // Returning key == null causes the default cache key to
// // be generated.
//
// key = RequestContext.BuildCompleteCacheKey(
// request,
// null, // sReportFilename
// this.GetType(),
// this.ShareDBLogonInfo );
return key;
}
}
}
有时我将.cs
文件中的命名空间更改为Vegi_Manager
而不是Vegi_Manager.VOUCHERS.SALE.BILLFORMATS,它可以工作但是当项目再次编译时,它会恢复为Vegi_Manager.VOUCHERS.SALE .BILLFORMATS并再次显示相同的错误。
导致上述错误的原因是什么?
答案 0 :(得分:8)
我收到了同样的错误,因为我将报表上的构建操作从Embedded资源更改为Resource。如果将构建操作更改为嵌入式资源,则应解决该问题。要更改它,请单击.rpt文件,然后转到其高级属性并单击Build Action下拉列表。
答案 1 :(得分:4)
如果您收到此错误:
Unable to find the report in the manifest resources.
通过以下步骤解决了问题:
现在将报告添加为保存rpt文件的现有文件,它将自动生成它的cs文件。
build&amp;运行你的解决方案。
来源:http://atikpassion.blogspot.in/2014/08/unable-to-find-report-in-manifest.html
答案 2 :(得分:1)
您需要在构造函数中修改文件的路径
Public Overrides Property FullResourceName() As String
Get
Return "**[path]**.BillFormat1.rpt"
End Get
Set
'Do nothing
End Set
End Property
答案 3 :(得分:0)
就我而言,这对我有用: 1.在Visual Studio中单击您的rpt文件 2.在“属性”窗口中,选中“构建操作” 3.将值更改为“嵌入式资源”
答案 4 :(得分:0)
在我的情况下,这是因为在父文件夹和报表的名称中有空格。如果您将它们命名为Foo Bar
,只需重命名FooBar
,它就可以正常工作。
答案 5 :(得分:0)
就我而言,报表的.cs文件在FullResourceName属性下具有错误的名称空间字符串值。当我从另一个项目复制该文件时,我曾手动操作过该文件,但错过了这个名称空间值。
答案 6 :(得分:0)
右键单击rpt文件,选择属性并转到Build Action下拉列表,然后 选择嵌入式资源。它对我有用。祝您一切顺利。
答案 7 :(得分:-1)
最后我可以解决问题
只需转到参考文献,然后选择所有dll
的{{1}}开头。
选择全部后,在属性表中找到crystalldesicion
属性,现在将其值更改为Copy Local
。
构建项目并保存所有内容。
现在已准备就绪。