Readme_Custom Report Item Sample

8/22/2011


This sample works only with SQL Server 2008 R2. It will not work with any version of SQL Server earlier than SQL Server 2008 R2.
PolygonsCRI is a simple custom report item sample. This sample uses the System.Component classes from the Microsoft .NET Framework and classes from the Microsoft.ReportDesigner and Microsoft.ReportingServices namespaces to implement a custom report item run-time component and design-time component that can be used in Report Designer.

Important:
Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.



Requirements

You should be familiar with Visual Studio and Microsoft Visual C#, and your system must meet the following requirements to use the PolygonsCRI sample:
  • Microsoft SQL Server 2008 R2 with Reporting Services.
  • Microsoft SQL Server Business Intelligence Development Studio.
  • Microsoft Visual Studio 2008 or later.
  • Microsoft .NET Framework 2.0.
  • Reporting Services samples.
  • A report server that you have permission to access on your network.
Note:
Business Intelligence Development Studio is not supported on Itanium-based computers. However, support is available for x64-based computers. If the SQL Server sample databases have been deployed on an Itanium-based computer, use BI Development Studio on either an x86-based or x64-based computer to modify and run the samples.
Important:
SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see Considerations for Installing SQL Server Samples and Sample Databases.


Location

By default, this sample is located in the following directory:
C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Extension Samples\PolygonCustomReportItem Sample

Building the Sample

If you have not already created a strong name key file, generate the key file using the following instructions.
To generate a strong name key file

1. Open a Microsoft Visual Studio 2008 (or Visual Studio 2010) command prompt. Click Start, point to All Programs, point to Microsoft Visual Studio 2008, then point to Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed. Note: To determine the folder where samples are located, click the Start* button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.*

3. At the command prompt, run the following command to generate the key file: sn -k SampleKey.snk Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
To build the PolygonsCRI sample

1. Open the \CS\PolygonsCRI.sln project file into Visual Studio 2008.

2. From the Build menu, select Build Solution.

Deploying the Sample

To deploy the PolygonsCRI sample

1. Edit the rsreportserver.config file (by default located in the directory %ProgramFiles%\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer) to register the PolygonsCRI:

2. Insert the following lines before the </Extensions> line:

<ReportItems>
   <ReportItem Name="Polygons" Type="Microsoft.Samples.ReportingServices.PolygonsCustomReportItem,PolygonsCRI"/>
</ReportItems> 
3. Edit the rssrvpolicy.config file (by default located in the directory %ProgramFiles%\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer) to add a code group for the custom report item:

4. Add the following lines and change the PROGRAMFILES string to your Program Files directory:

<CodeGroup 
   class="UnionCodeGroup" 
   version="1" 
   PermissionSetName="FullTrust"
   Description="This code group grants PolygonsCRI.dll FullTrust permission. ">
   <IMembershipCondition 
   class="UrlMembershipCondition"
   version="1"
   Url="PROGRAMFILES\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin\PolygonsCRI.dll" />
</CodeGroup> 
5. Edit the rsreportdesigner.config file (by default located in the directory C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies) to register the run-time component, the design-time component, and the item type converter:

6. Add the following lines before the </Extensions> line:

<ReportItems>
   <ReportItem Name="Polygons" Type="Microsoft.Samples.ReportingServices.PolygonsCustomReportItem,PolygonsCRI"/>
</ReportItems>
<ReportItemDesigner>
   <ReportItem Name="Polygons" Type=" Microsoft.Samples.ReportingServices.PolygonsDesigner, PolygonsDesigner" />
</ReportItemDesigner> 
7. Copy the PolygonsCRI.dll file from the \CS\PolygonsCRI\Bin\Debug directory where you copied the sample project to the Visual Studio private assemblies directory (by default, %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies).

8. Copy the PolygonsCRI.dll file from the \CS\PolygonsCRI\Bin\Debug directory where you copied the sample project to the Microsoft SQL Server Reporting Services bin directory (by default, %ProgramFiles%\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\Bin).

9. Copy the PolygonsDesigner.dll file from the \CS\PolygonDesigner\Bin\Debug directory to the Visual Studio private assemblies directory (by default, %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies).

Running the Sample

This section contains a quick walkthrough that shows how to reference the Polygon custom report item in Visual Studio and then test it.
To add PolygonDesigner to the Visual Studio Toolbox

1. Right-click the Visual Studio Toolbox.

2. Select Choose items.

3. Navigate to the %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies folder and select PolygonsDesigner.dll.
To publish and view the sample on the report server

1. Restart the Reporting Services service by running the following commands at the command prompt:

      net stop "SQL Server Reporting Services %INSTANCENAME%
      net start "SQL Server Reporting Services %INSTANCENAME%

2. With the Polygons.sln solution opened, in the Solution Explorer, right-click the Polygons project, and click Deploy.

3. In the brower, access the report server URL and click the Polygons report to view it.

To edit a report using the PolygonDesigner custom control in Visual Studio, you can do any of the following:
  • Set the properties of the polygons control in the property browser.
  • Edit properties through the control's shortcut menu.
  • Drag fields onto the drop areas of the control from the fields list.

See Also

Tasks
Compiling and Running Code Examples Reporting Services Samples
Other Resources
Custom Report Item Implementation Requirements Extension Samples (Reporting Services)
Help and Information
  • Getting SQL Server 2008 R2 Assistance* © 2011Microsoft Corporation. All rights reserved.

Last edited Aug 25, 2011 at 1:08 AM by mariwill, version 1

Comments

Ucodia Sep 29, 2011 at 5:00 PM 
Hello,

I got it working properly in Visual Studio 2010 and on the report server. The problem is that I have no idea how to deploy this custom report item to make it available in Report Builder 3.0. I know we can also add custom report item to the Report Builde toolbox but I did not found any guidance for that.

Any clue?

Thanks.