Link to home
Start Free TrialLog in
Avatar of Rajkumar Gs
Rajkumar GsFlag for India

asked on

'CrystalReportViewer' is ambiguous in the namespace 'CrystalDecisions.Web'

We are working on ASP.Net website. We have some reports with Crystal Reports.
We recently upgraded from Visual Studio 2005 to Visual Studio 2008. Then some issues started...

1. In development machine, reports are working perfectly.
2. In our local Testing environment (Windows Server 2003), it is showing this error message
'CrystalReportViewer' is ambiguous in the namespace 'CrystalDecisions.Web'
User generated image
These are configuration of development machine and source code
In our development machine, we have two version of Crystal Reports installed.
- Crystal Reports for Visual Studio 2005 (v10.2.3600.0) and
- Crystal Reports for Visual Studio 2008 (v 10.5.3700.0)

This is the screenshot of GAC in development machineUser generated image
In our Source code - References, we have referred only Crystal Reports for Visual Studio 2008 only (10.5.3700.0) User generated image
Source Code of ASPX Page - See here also we have referred latest version of Crystal Reports.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Sales_ReportV2.aspx.vb" Inherits="Sales_ReportV2" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    

    
<%@ Register Assembly="CrystalDecisions.Web, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
    <%@ Register Assembly="CrystalDecisions.Shared, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Shared" TagPrefix="CR" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Sales Report</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
   <link href="css/escc.css" rel="stylesheet" type="text/css" />
    <link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
        rel="stylesheet" type="text/css" />
    <script type ="text/javascript">
	function MaximizeWindow()
	{
		if (document.all || document.layers) {
		  self.moveTo(0,0);
		  self.resizeTo(screen.availWidth, screen.availHeight);
		}
	}
    </script>

</head>
<body style="overflow:auto; background-image : none; background-color:White ; " onload="javascript:MaximizeWindow();">
    <form id="frmPrintPreviewProposal" runat="server">
  <CR:CrystalReportViewer ID="CrystalReportViewerHead" runat="server" Height="1039px" 
        ReportSourceID="Sales_ReportSource" Width="901px" HyperlinkTarget="_blank"></CR:CrystalReportViewer>
        <CR:CrystalReportSource ID="Sales_ReportSource" runat="server">
            <Report FileName="Reports\Sales_Report.rpt">
            </Report>
    </CR:CrystalReportSource>
          <asp:Panel ID="toolTipErrorMsg" runat="server" CssClass="popupcurve" Visible="false">
                            <table style="width: 100%;" class="popupcurve_inside">
                                <tr>
                                    <td>
                                        <h1>
                                            <asp:Label ID="lblmsgheading" runat="server" Font-Bold="true" Text="Message!">
                                            </asp:Label></h1>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="lblmsg" runat="server">
                                        </asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center">
                                        <asp:Button ID="btnErrOk" Visible="true" Width="75px" CssClass="btnb" runat="server"
                                            Text="OK" />
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
    </form>
</body>
</html>

Open in new window



Web.config
	<assemblies>
.....
				<add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.VSDesigner, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="CrystalDecisions.Windows.Forms, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
			</assemblies>

Open in new window


In Brief:-
In development, Site is working with the above shown settings.
But once we host this site to testing environment, it is crashing (Screenshot I already posted)
In server also we have both versions of Crystal Reports installed.

I believe - I have provided relevant details. - How can I get around this issue ?

Any suggestion would be great to me - Please help

Raj
Avatar of Rahul Agarwal
Rahul Agarwal
Flag of India image

Avatar of Rajkumar Gs

ASKER

I already search in Experts-Exchange before posting this question.

Use the fully qualified crystalreportviewer.
"crystaldecisions.Web.CrystalReportViewer"

Nowhere I am using 'CrystalReportViewer' in code-behind.

Raj
I think here is some issue:

<%@ Register Assembly="CrystalDecisions.Web, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

 <%@ Register Assembly="CrystalDecisions.Shared, Version=10.5.3700.0 , Culture=neutral, PublicKeyToken=692fbea5521e1304"    Namespace="CrystalDecisions.Shared" TagPrefix="CR" %>

Both of these directives have the same TagPrefix="CR"

Hope this helps.
Thanks Abdul for your suggestion.

Actualy 'CrystalDecisions.Shared' is not using in the ASPX page. I removed it. Still the same error

If I am right, this error 'CrystalReportViewer' is ambiguous in the namespace 'CrystalDecisions.Web' seems to be since 'CrystalReportViewer' is there in two namespaces referred in the project. But I can see only one version of Crystal Report referred there.

Any thoughts ?
Raj
if that's the case please try to remove/comment unused Assemblies in your Web.config
Avatar of Mike McCracken
Mike McCracken

It indicates you have referenced 2 versions of the viewer.

This link has a link to a module checking tool
http://forums.sdn.sap.com/thread.jspa?threadID=1842278

mlmcc
mlmcc,

I tried the tool in the link that you posted in development server. It is showing the modules of Crystal Reports
- CrystalDecision.Shared.DLL
- CrystalDecisions.VsDesigner.DLL
- CrystalDecisions.Web.DLL
- CrystalDecisions.Windows.Forms.DLL
twice.
For WEBDEV.WEBSERVER.EXE & DEVENV.EXE

I don't understand why it is not showing 'ambiguious' error in web server, while working in development machine ? Both machines have both versions of Crystal Reports - at the same time in code, I have refered only newer version.

According to the code and screenshots that I posted in the main question, could you please suggest where I need to correct ?

Raj
Another important thing I noticed using that tool is that eventhough two DLLs are listed, both  DLL are seems to of 10.5 version  - Check this screenshot
 User generated image
Any idea ?

Raj
The above screenshot is when I ran that tool in development machine.
Raj
Can you run it on the prod machine?

mlmcc
We didn't go for Client's producton yet. Only in our local testing environment and Client's UAT Server.

In Client's UAT Server also I faced hardtime to fix it out. Evenif I installed CR 10.5, there it was crashing by showing another error - Something like "Crystal Reports was not properly installed or registry keys are corrupted. Reinstall from Cryst.exe ... " - some similar error message like that
I managed this issue by uninstall all versions of Crystal Reports and install Crystal Reports Setup uploaded from our machine - C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5
In this folder, there are setups for 32 bit and 64 bit OS. First when I installed 64 bit setup in the UAT 64 bit Windows 2003 Server, it was still showing the same error. But when I installed 32-bit setup in 64-bit system, it is working perfectly. Then I faced another issue - icons in the toolbar of the crystal report viewer was not showing. That's also I manged to fix by copy paste the image folder to proper location.

>> Can you run it on the prod machine?
Anyway I need our admin's permission to install this tool in our testing server. I am proceeding with that - I will do that and let you know

By the way - Please clarify these
1. If we using Crystal Reports for Visual Studio 2008, there could be older version of the same assembly in the Webserver where we are hosting this website. Someother sites may be using older version.
I am sure that if we uninstall older version, this error will go - but that is not a good solution. So I believe - it is good to fix this issue by make this site work in an environment that is having older and newer version of assembly of Crystal Reports installed and loaded in memory. That is what I am trying to achieve

It is crucial when we are going for publish to client's production server - as they have older and newer versions of CR used by different sites.

Is this tool help me to get around this way ?

2. According to the code and screenshots that I posted in the main question, could you please suggest where I need to correct ?

mlmcc - I highly appreciate your support. Hope you could help me to overcome this challenge

Raj
ASKER CERTIFIED SOLUTION
Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Guys for your attempt to help me.
Raj