9

I am using a crystal reports through crystal report viewer server side control in a webform.

I am using a webform because the crystal report viewer provides an easy way to export to PDF and to Excel.

My problem is that when I deploy to the server, the crystal report .rpt file does not get copied to the target folder.

My solution structure looks like this:

Solution
 |-Content
 |-Controllers
 |-Models
 |-Views
 |-etc...
 |-Reports
    |-Default.aspx
    |-Report.rpt

On the server, the Report.rpt file is missing after I publish.

Andrew
  • 11,068
  • 17
  • 52
  • 62

1 Answers1

25

If you right click on the Report.rpt file in Solution explorer and view the properties, make sure that the "Build Action" is set to Content. I believe by default it is set to Embedded resource.

Luke
  • 2,101
  • 19
  • 21
  • @Luke: but why the default is Embedded Resource? Are we supposed to access it like that? Best practice may be? – Hoàng Long Jul 22 '16 at 03:26
  • 3
    @HoàngLong, first off, I want to tell you that you have my condolences that you are still fighting this battle over 6 years later. I'm far removed from this at this point in my career, however I would hazard a guess that the thought process is that the default behavior is that any file that is handled by IIS by default (i.e. static files, aspx, etc) is considered content, any binaries (i.e. dll's, exe's) are built, and anything else defaults to embedded content. Good luck on finding a path to working on something other than crystal reports. – Luke Jul 22 '16 at 22:18