Publishing RDLC files

前端 未结 4 533
夕颜
夕颜 2020-12-08 05:00

I have a few RDLC files in my WPF application. When I publish the project, the report files don\'t get published, and when I try to access them with the client I get an erro

相关标签:
4条回答
  • 2020-12-08 05:07

    I've been using the answer by @nos for a while, but I noticed that in the publication, the set of .rdlc-files is copied to two places:

    1. The original webapplication project relative location;
    2. Inside the bin folder.

    So if I had \Reports\Report1.rdlc, I would find in the published location:

     1. <published folder>\Reports\Report1.rdlc;
     2. <published folder>\bin\Reports\Report1.rdlc.
    

    I don't mean to use copies of the rdlc's in the second location and, indeed, if I delete these, the reports are still generated.

    I changed the settings for each rdlc-file to:

    Build Action: Content;
    Copy to Output Directory: Do not copy.
    

    And now nothing is written to the second location.

    0 讨论(0)
  • 2020-12-08 05:16

    Sorry guys this has nothing to do with "Copy Always" or "Copy if Newer". In fact I set it to "Never Copy". This issue is resolved by changing the Build Action from "Embedded Resource" to "Content". Then when you build and publish RLDC files will get copied to the right place.

    0 讨论(0)
  • 2020-12-08 05:20

    I don't know if there's special concerns with RDLC files, but here's the general approach for making sure other files get published.

    Right click the file in the solution explorer, select Properties. Set the "Build Action" to "Content", and "Copy to output Directory to "Copy if newer".

    Go to the project properties->Publish page. Hit "Application Files Button", check "Show all files". Set the "Publish Status" to "Include (auto)"

    File Properties

    File Properties

    Application Files

    Publish Properties

    0 讨论(0)
  • 2020-12-08 05:26

    instead of using .ReportPath

    1. **used the following code:

    reportViewer1.LocalReport.ReportEmbeddedResource="[Project
    Name].[FolderName if Exist].[ReportName].rdlc";
    
    1. Then rebuild your deployment Project.
    0 讨论(0)
提交回复
热议问题