none
Where do I specify the .rdlc file's location? RRS feed

  • Question

  • I'm working on my first WPF app, which will use the report controls in VS 2010.  Using the following URL:

    http://msdn.microsoft.com/en-us/library/ms252091.aspx

    which is a walkthrough showing you how to print a LocalReport without preview, I am working on printing my report without letting the user see a print preview, which is how they want this application to work.  My concern is where do I specify the location of the .rdlc file?  In that above linked walkthrough the report given there is specified like this:

    report.ReportPath = @"..\..\Report.rdlc";
    
    

    but how do I do that in my application?  This works fine, in development, because my .rdlc file is at the root of the solution, but when I deploy this application, where is it going to live?  I intend to deploy it using ClickOnce.


    Rod
    Friday, August 20, 2010 5:14 PM

All replies

  • A couple of thoughts come to mind.

    1. Your program could create a location on the disk and always put the reports there. Maybe a folder on All Users desktop or something like that.

    2. You could prompt a dialog box to the user the first time the program runs and get the report location from the user.

    3. You could use the installer to create the location for the reports. This one I'm not sure how to do and if it's completely possible.

    Where do you want the reports to be stored?

    Bernie

     

    Sunday, August 22, 2010 7:39 PM
  • Ideally, I would like the report file to be located in the same folder as the .exe file.  I can see why, during development, this isn't as easily done, because all of the source files are at the solution folder level, but when you compile the app, during development, the .exe is put either at bin\Debug or bin\Release
    Rod
    • Edited by Rod at Work Monday, August 23, 2010 5:10 PM Added info
    Monday, August 23, 2010 5:07 PM
  • OK, so you know where you are going to install the program. Have the installer put the rdlc there also.

     

    Monday, August 23, 2010 6:05 PM
  • Hi Rob,

    Based on your description, you want to copy the local report(.rdlc) to the sample folder of the compiled application, and now you want to know how to set the ReportPath. If I have misunderstood, please don't hesitate to let me know.

    If the reports are in the same folder of the compiled application, the ReportPath can be <reportname>.rdlc
            report.ReportPath = @"Report.rdlc";
    However, please make sure the report is always copied to the bin folder:

    1. In the 'Solution Explorer' pane, right click the report
    2. Click 'Properties'
    3. Set the item 'Copy to Outpub Directory' to be 'Copy always'

    If you have any more questions, please feel free to ask.

    Thanks,
    Jin Chen


    Jin Chen - MSFT
    Tuesday, August 24, 2010 9:44 AM
  • Hi Jin,

    OK, will do.  But why?  I mean, why does copying the .rdlc file to the bin folder, and then setting the .rdlc to 'Copy to Output Directory' do for me?

     


    Rod
    Wednesday, August 25, 2010 4:01 PM
  • Hi Rob,

    The localreport.ReportPath is a physical path.

    The following code will works fine too, but please make sure the relative path is correct.
            report.ReportPath = @"..\..\Report.rdlc";

    Copying the file to bin folder may be easy to use.

    Thanks,
    Jin Chen


    Jin Chen - MSFT
    Thursday, August 26, 2010 1:55 AM
  • Hi Jin,

    I'm now experimenting with the ClickOnce deployment.  I did as you suggested and right-clicked the .rdlc file, selected Properties and then selected the selected the 'Copy to Output Directory' and made sure it was set to 'Copy always'.  I then rebuilt the whole solution, and published it to a network share.  I've installed the app from there, but the .rdlc isn't there.  Why is that?  (I don't know if this has any bearing on what my problem is, or not, but the 'Build Action' is set to 'Embedded Resource'.  Is that correct, or does it not matter?)

     


    Rod
    Tuesday, August 31, 2010 8:18 PM
  • Follow-up.  I set the 'Build Action' to 'Content', and that seems to have fixed the problem.

     


    Rod
    Tuesday, August 31, 2010 8:30 PM