简体   繁体   English

将RPT文件加载到C#Windows服务中

[英]Load a RPT file into C# windows service

I want to load a .rpt file which I have putted into my solution. 我要加载已放入解决方案中的.rpt文件。

I am trying to load it as :: 我正在尝试将其加载为::

        rd.Load(AppDomain.CurrentDomain.BaseDirectory+(@"\Reports\InvoiceDocument.rpt"));

But getting the Problem in this loading. 但是在此加载中遇到了问题。 Because the Path given by AppDomain.CurrentDomain.BaseDirectory is the Path to 'bin' folder. 因为AppDomain.CurrentDomain.BaseDirectory给出的路径是“ bin”文件夹的路径。 But my rpt file is in parent folder. 但是我的rpt文件在父文件夹中。

I know this can be a kind of Basic question but I stucked. 我知道这可能是一种基本问题,但我坚持了下来。

rd.Load(AppDomain.CurrentDomain.BaseDirectory+(@"..\Reports\InvoiceDocument.rpt"));

When you deploy the application, where the rpt file will be? 部署应用程序时,rpt文件将在哪里?

If you need to be in the same directory that your executable, then select the rpt file in the solution explorer and, in properties, set the property 'copy to output directory' to copy always or copy if newer . 如果需要与可执行文件位于同一目录中,请在解决方案资源管理器中选择rpt文件,然后在属性中将属性“复制到输出目录”设置为始终 复制复制(如果较新)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM