简体   繁体   中英

Load a RPT file into C# windows service

I want to load a .rpt file which I have putted into my solution.

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. But my rpt file is in parent folder.

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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