The Haphazard Blog

Microsoft .Net Report Viewer with Visual Studio Express Editions

by on September 3, 2009 7:12 PM, under Software Development, Technology

I recently was given some code written in C# and was unable to get the solution to build. I was getting the following error using Visual C# 2008 Express SP1:

The type or namespace name ‘Reporting’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)

I tried a lot of things recommended by MSFT experts on the MSDN forums to no avail. I installed the Microsoft Report Viewer 2008 SP1 Redistributable. Still couldn’t build. I couldn’t locate the library through the toolbox either. Later I found that the necessary DLLs never were installed. I tried other report viewer redistributables. I even tried getting the files from another developer and placing them in the correct location. I still could not add them through the toolbox. Some people said that I need to install Visual Web Developer. I had it installed so that did not matter. Everything I tried would not allow me to use the Microsoft.Reporting.WebForms or Microsoft.Reporting.WinForms libraries.

This is the solution I found to work and it makes sense. You need to install the SQL Server Express 2008 Runtime with Advanced Services. If you just installed any of the Visual Studio Express editions, then it automatically installed SQL Server Express 2008 Compact Edition. That is missing the reporting services and you had no option to install anything. You can install the whole thing from Microsoft’s SQL Server Express download site. Note that this will install another instance of SQL Server Express in addition to Compact (if you have it installed). It won’t upgrade it.

I found the cleanest way to do it is to install SQL Server Express 2008 Runtime with Advanced Services first and then install the VS Express editions. They will recognize that SQL Server is installed and skip SQL Server Express Compact Edition.

:, , ,

10 Comments for this entry

  • from Excessive

    Hello, does this also work for Visual Studio 2010 Express editions?

    Thanks!

  • from Jitesh Gandhi

    The version of Visual Studio should not matter. The libraries are part of SQL Server. SQL Server 2008 R2 Express does also contain Reporting Services. I would expect this would resolve the same issue, but I have not tried it. Since this post, I have upgraded to the full versions of Visual Studio 2010 and SQL Server 2008 R2.

  • from Thirdy

    Hello Jitesh.

    I got a VS 2010 Express with SQL Server Express R2 with Advanced Reporting Services options.

    But I could not still reference Microsoft.Reporting nor could I see a Report Viewer control on my Toolbox.

    Any suggestion or work around to show the namespace for Microsoft.Reporting or much better to show the Report Viewer control on my Toolbox?

    Thank you for your reply ahead.

    GOD bless.

    Thirdy

  • from Jitesh Gandhi

    What framework are you targeting? Try targeting 3.0 or 3.5 instead of 4.0.

  • from Thirdy

    Yes! you got it right. I change it to 3.5 (and early 3.0) and it both works. I could now see my ReportViewer.

    Thanks a lot!!!

    GOD bless.

  • from Thirdy

    Jitesh, there is a problem. I could see the report viewer both on my Toolbox and the lower pane of the VS IDE however I could not see the Report Viewer on the form itself. Any idea what could have happen? Thanks again and GOD bless.

  • from Jitesh Gandhi

    You will need to clarify what pane you mean. Are you saying you don’t see the control in the design view but it shows up in source after you drag it onto the main window? Are you creating a WinForm application or a WPF application?

  • from Thirdy

    Hello Jitesh.

    First of all thank you for your patience.

    What I mean by the word ‘pane’ is the one where you drop for example a Binding Source or a Menu Strip or Tool Strip etc. The Report Viewer shows up there but it is not showing up on my form itself which should be. Like for example if you Drop a menu strip it will show in that lower pane that I mentioned plus on the form itself. Unfortunately again in my case it shows on that lower pane only but not on the form itself.

    When I drop a report viewer control by the way, the code for that control could also be seen in my code behind more specifically in my Form1.Designer.cs for example which is a dotNet auto-generated code as you probably know.

    I am using WinForm by the way and I am not developing a WPF application.

    Thanks again for your reply my friend.

    GOD bless you.

  • from Jitesh Gandhi

    Thirdy,

    I’m not sure what the issue is in this case. When you run the application, is the report viewer shown? Try editing the designer code to use “this” when referencing the ReportViewer object, for example

    this.Controls.Add(this.reportViewer1);

    or try removing “this” when referencing the ReportViewer object, for example

    Controls.Add(reportViewer1);

    I got this idea from some using VB.NET, and the added the “Me” keyword to get it to appear on the Form.

    Good luck!

    Jitesh

  • from Alex Leblois

    This is very informative article. Thanks for sharing with us. Below links a very helpful to complite my task.

    http://msdn.microsoft.com/en-us/library/aa337089(v=sql.90).aspx

    http://www.mindstick.com/Articles/13169999-ef3b-496c-b502-caef973c3bb2/?Using%20ReportViewer%20in%20WinForms%20C

Leave a Reply