我有一个项目,我将我的报告文件放入其中,现在我想在另一个项目中引用它们,我尝试了这段代码:
StiReport.Load(new Uri("pack://application:,,,/GoldAccountingSystem.Reports;component/StimulReports/TBank.mrt")
.LocalPath);
但是我收到了这个错误:
Could not find a part of the path 'E:\GoldAccountingSystem.Reports;component\StimulReports\TBank.mrt'.
GoldAccountingSystem.Reports
是报告的程序集名称,但我不知道为什么它会在E
中查找此程序集,尽管正确的地址为E:\Projects\GoldAccountingSystem\GoldAccountingSystem.Reports
。
我认为这是因为报告作为内容而不是资源添加到项目中。任何想法?
答案 0 :(得分:0)
你应该尝试相对Uri:
StiReport.Load(new Uri("/GoldAccountingSystem.Reports;component/StimulReports/TBank.mrt")
.LocalPath);
绝对的Uri也应该有效:
StiReport.Load(new Uri("pack://application:,,,/GoldAccountingSystem.Reports;component/StimulReports/TBank.mrt", UriKind.Absolute)
.LocalPath);