File path problems when creating the project installer with ClickOnce


I have created an installer for my C # project with clickonce, but I have a problem with my file path, in this case with rdlc files (reportviewer), I declare it as follows:

        String rutadocumento = (Application.StartupPath).Replace("\bin\Debug", "");
        Microsoft.Reporting.WinForms.LocalReport report = new Microsoft.Reporting.WinForms.LocalReport();
        report.DisplayName = nameArchivoMostrar;
        report.ReportPath = rutadocumento + "\Reportes\" + nombreReporte;

When I run it from the visual studio, I do not have any problems, but when I create the installation, it does not find the file path (rutadocumento + "\ Reports \" + nombreReporte).

I would like to know if I should copy the Reports folder in any specific part and where. I would also like to know if the path reference is correct (report.ReportPath.ReportPath = rutadocumento + "\ Reports \" + nombreReporte), to work.

asked by Danilo 08.08.2017 в 18:02

1 answer


Files with the *.rdlc extension do not need to be compiled by the IDE (Visual Studio), they only need to be considered when compiling.

Therefore, in the properties of the files it is necessary to configure the following:

  • Build Action:

Content (content): The file is not compiled, but is included in the content results group.

  • Copy to output directory (Copy to Output Directory):

Always copy (copy always): The file will always be copied to the result directory.

For example:


answered by 08.08.2017 / 18:30