without loading VS2005 on user machine how to make app work? Dev

R

Rich

On my development machine where I have Visual Studio 2005 loaded, I have an
app that uses the Report control. I can view data in report format with the
Report control -- the data renders OK in the Report control. My problem is
in rendering the report from the rdlc file for printing to a line printer.

Following the example from MSDN Help at

http://msdn2.microsoft.com/en-us/library/ms252172(VS.80).aspx

I can print the rdlc report file to the line printer from my development
machine. But I deployed the same app app to a User's machine (using Click
once), and the print job failed at

report.Render("Image", deviceInfo, CreateStream, out warnings);

Does anyone have any idea what file/reference/library I need to include in
the deploy without having to load VS2005 on the user machine? Note: I am
already including the refence to Microsoft.ReportViewer.Common and
Microsoft.ReportViewer.Winforms, and I already copy the entire content of the
Report rdlc file

Here is the area where the print job is failing (--the entire code for the
print routine is at
http://msdn2.microsoft.com/en-us/library/ms252172(VS.80).aspx--)

private Stream CreateStream(string name, string fileNameExtension,
Encoding encoding, string mimeType, bool willSeek)
{
Stream stream = new FileStream(name + "." + fileNameExtension,
FileMode.Create);
m_streams.Add(stream);
return stream;
}

private void Export(LocalReport report)
{
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream, out warnings); <<<---fails
here

foreach (Stream stream in m_streams)
stream.Position = 0;
}
 
R

Rich

I observed that I my own development machine, I have the same printing
problem from the deployed application, but if I invoke the exe from
..../bin/debug/myapp.exe
then the print works OK. So obviously something is not getting deployed. I
need to include something in the Prerequisites ... but what?
 
R

Rich

I found the problem and post the solution - for future reference.

The problem was with the report rendering. It turns out that in the
development environment I was referencing the rdlc file in one location on
the dev machine which was not in the bin folder, but on deployment the rdlc
file was deploying with the .exe to a subfolder in the
application.startupPath. So I changed my path reference to
application.startupPath\subfolder and now the operation works correctly
after deployment.
 
Top